diff --git a/packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_service/async_client.py b/packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_service/async_client.py index d9dd2b835808..3229f3793023 100644 --- a/packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_service/async_client.py +++ b/packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1/services/assured_workloads_service/async_client.py @@ -229,9 +229,9 @@ async def create_workload( from google.cloud import assuredworkloads_v1 - def sample_create_workload(): + async def sample_create_workload(): # Create a client - client = assuredworkloads_v1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) workload = assuredworkloads_v1.Workload() @@ -249,7 +249,7 @@ def sample_create_workload(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -355,9 +355,9 @@ async def update_workload( from google.cloud import assuredworkloads_v1 - def sample_update_workload(): + async def sample_update_workload(): # Create a client - client = assuredworkloads_v1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) workload = assuredworkloads_v1.Workload() @@ -370,7 +370,7 @@ def sample_update_workload(): ) # Make the request - response = client.update_workload(request=request) + response = await client.update_workload(request=request) # Handle the response print(response) @@ -470,9 +470,9 @@ async def delete_workload( from google.cloud import assuredworkloads_v1 - def sample_delete_workload(): + async def sample_delete_workload(): # Create a client - client = assuredworkloads_v1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) request = assuredworkloads_v1.DeleteWorkloadRequest( @@ -480,7 +480,7 @@ def sample_delete_workload(): ) # Make the request - client.delete_workload(request=request) + await client.delete_workload(request=request) Args: request (Union[google.cloud.assuredworkloads_v1.types.DeleteWorkloadRequest, dict]): @@ -553,9 +553,9 @@ async def get_workload( from google.cloud import assuredworkloads_v1 - def sample_get_workload(): + async def sample_get_workload(): # Create a client - client = assuredworkloads_v1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) request = assuredworkloads_v1.GetWorkloadRequest( @@ -563,7 +563,7 @@ def sample_get_workload(): ) # Make the request - response = client.get_workload(request=request) + response = await client.get_workload(request=request) # Handle the response print(response) @@ -652,9 +652,9 @@ async def list_workloads( from google.cloud import assuredworkloads_v1 - def sample_list_workloads(): + async def sample_list_workloads(): # Create a client - client = assuredworkloads_v1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) request = assuredworkloads_v1.ListWorkloadsRequest( @@ -665,7 +665,7 @@ def sample_list_workloads(): page_result = client.list_workloads(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-assured-workloads/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py b/packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py index 407faf213e35..ab66095e0d26 100644 --- a/packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py +++ b/packages/google-cloud-assured-workloads/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py @@ -231,9 +231,9 @@ async def create_workload( from google.cloud import assuredworkloads_v1beta1 - def sample_create_workload(): + async def sample_create_workload(): # Create a client - client = assuredworkloads_v1beta1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1beta1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) workload = assuredworkloads_v1beta1.Workload() @@ -250,7 +250,7 @@ def sample_create_workload(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -356,9 +356,9 @@ async def update_workload( from google.cloud import assuredworkloads_v1beta1 - def sample_update_workload(): + async def sample_update_workload(): # Create a client - client = assuredworkloads_v1beta1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1beta1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) workload = assuredworkloads_v1beta1.Workload() @@ -370,7 +370,7 @@ def sample_update_workload(): ) # Make the request - response = client.update_workload(request=request) + response = await client.update_workload(request=request) # Handle the response print(response) @@ -470,9 +470,9 @@ async def delete_workload( from google.cloud import assuredworkloads_v1beta1 - def sample_delete_workload(): + async def sample_delete_workload(): # Create a client - client = assuredworkloads_v1beta1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1beta1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) request = assuredworkloads_v1beta1.DeleteWorkloadRequest( @@ -480,7 +480,7 @@ def sample_delete_workload(): ) # Make the request - client.delete_workload(request=request) + await client.delete_workload(request=request) Args: request (Union[google.cloud.assuredworkloads_v1beta1.types.DeleteWorkloadRequest, dict]): @@ -562,9 +562,9 @@ async def get_workload( from google.cloud import assuredworkloads_v1beta1 - def sample_get_workload(): + async def sample_get_workload(): # Create a client - client = assuredworkloads_v1beta1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1beta1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) request = assuredworkloads_v1beta1.GetWorkloadRequest( @@ -572,7 +572,7 @@ def sample_get_workload(): ) # Make the request - response = client.get_workload(request=request) + response = await client.get_workload(request=request) # Handle the response print(response) @@ -670,9 +670,9 @@ async def list_workloads( from google.cloud import assuredworkloads_v1beta1 - def sample_list_workloads(): + async def sample_list_workloads(): # Create a client - client = assuredworkloads_v1beta1.AssuredWorkloadsServiceClient() + client = assuredworkloads_v1beta1.AssuredWorkloadsServiceAsyncClient() # Initialize request argument(s) request = assuredworkloads_v1beta1.ListWorkloadsRequest( @@ -683,7 +683,7 @@ def sample_list_workloads(): page_result = client.list_workloads(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-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.py b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.py index 59e76e7d3e78..f7e4a6c55933 100644 --- a/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.py +++ b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.py @@ -776,7 +776,7 @@ def test_create_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads.CreateWorkloadRequest() - 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.create_workload), "__call__") as call: @@ -792,7 +792,7 @@ def test_create_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -806,7 +806,7 @@ async def test_create_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads.CreateWorkloadRequest() - 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.create_workload), "__call__") as call: @@ -824,7 +824,7 @@ async def test_create_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1052,7 +1052,7 @@ def test_update_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads.UpdateWorkloadRequest() - request.workload.name = "workload.name/value" + request.workload.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workload), "__call__") as call: @@ -1068,7 +1068,7 @@ def test_update_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workload.name=workload.name/value", + "workload.name=name_value", ) in kw["metadata"] @@ -1082,7 +1082,7 @@ async def test_update_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads.UpdateWorkloadRequest() - request.workload.name = "workload.name/value" + request.workload.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workload), "__call__") as call: @@ -1100,7 +1100,7 @@ async def test_update_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workload.name=workload.name/value", + "workload.name=name_value", ) in kw["metadata"] @@ -1286,7 +1286,7 @@ def test_delete_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads.DeleteWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: @@ -1302,7 +1302,7 @@ def test_delete_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1316,7 +1316,7 @@ async def test_delete_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads.DeleteWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: @@ -1332,7 +1332,7 @@ async def test_delete_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1548,7 +1548,7 @@ def test_get_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads.GetWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workload), "__call__") as call: @@ -1564,7 +1564,7 @@ def test_get_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1578,7 +1578,7 @@ async def test_get_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads.GetWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workload), "__call__") as call: @@ -1596,7 +1596,7 @@ async def test_get_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1780,7 +1780,7 @@ def test_list_workloads_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads.ListWorkloadsRequest() - 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_workloads), "__call__") as call: @@ -1796,7 +1796,7 @@ def test_list_workloads_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1810,7 +1810,7 @@ async def test_list_workloads_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads.ListWorkloadsRequest() - 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_workloads), "__call__") as call: @@ -1828,7 +1828,7 @@ async def test_list_workloads_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1959,7 +1959,7 @@ def test_list_workloads_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, assuredworkloads.Workload) for i in results) diff --git a/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py index eb4206aca47e..8a4191da7127 100644 --- a/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py +++ b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py @@ -779,7 +779,7 @@ def test_create_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.CreateWorkloadRequest() - 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.create_workload), "__call__") as call: @@ -795,7 +795,7 @@ def test_create_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -809,7 +809,7 @@ async def test_create_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.CreateWorkloadRequest() - 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.create_workload), "__call__") as call: @@ -827,7 +827,7 @@ async def test_create_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1067,7 +1067,7 @@ def test_update_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.UpdateWorkloadRequest() - request.workload.name = "workload.name/value" + request.workload.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workload), "__call__") as call: @@ -1083,7 +1083,7 @@ def test_update_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workload.name=workload.name/value", + "workload.name=name_value", ) in kw["metadata"] @@ -1097,7 +1097,7 @@ async def test_update_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.UpdateWorkloadRequest() - request.workload.name = "workload.name/value" + request.workload.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workload), "__call__") as call: @@ -1115,7 +1115,7 @@ async def test_update_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workload.name=workload.name/value", + "workload.name=name_value", ) in kw["metadata"] @@ -1302,7 +1302,7 @@ def test_delete_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.DeleteWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: @@ -1318,7 +1318,7 @@ def test_delete_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1332,7 +1332,7 @@ async def test_delete_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.DeleteWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: @@ -1348,7 +1348,7 @@ async def test_delete_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1576,7 +1576,7 @@ def test_get_workload_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.GetWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workload), "__call__") as call: @@ -1592,7 +1592,7 @@ def test_get_workload_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1606,7 +1606,7 @@ async def test_get_workload_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.GetWorkloadRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workload), "__call__") as call: @@ -1624,7 +1624,7 @@ async def test_get_workload_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1809,7 +1809,7 @@ def test_list_workloads_field_headers(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.ListWorkloadsRequest() - 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_workloads), "__call__") as call: @@ -1825,7 +1825,7 @@ def test_list_workloads_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1839,7 +1839,7 @@ async def test_list_workloads_field_headers_async(): # a field header. Set these to a non-empty value. request = assuredworkloads_v1beta1.ListWorkloadsRequest() - 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_workloads), "__call__") as call: @@ -1857,7 +1857,7 @@ async def test_list_workloads_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1988,7 +1988,7 @@ def test_list_workloads_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, assuredworkloads_v1beta1.Workload) for i in results)