diff --git a/gapic/samplegen/samplegen.py b/gapic/samplegen/samplegen.py index 2db9d8c9db..876f0b9d0a 100644 --- a/gapic/samplegen/samplegen.py +++ b/gapic/samplegen/samplegen.py @@ -293,7 +293,15 @@ def preprocess_sample(sample, api_schema: api.API, rpc: wrappers.Method): sample["module_name"] = api_schema.naming.versioned_module_name sample["module_namespace"] = api_schema.naming.module_namespace - sample["client_name"] = api_schema.services[sample["service"]].client_name + # Assume the gRPC transport if the transport is not specified + sample.setdefault("transport", api.TRANSPORT_GRPC) + + if sample["transport"] == api.TRANSPORT_GRPC_ASYNC: + sample["client_name"] = api_schema.services[sample["service"] + ].async_client_name + else: + sample["client_name"] = api_schema.services[sample["service"]].client_name + # the type of the request object passed to the rpc e.g, `ListRequest` sample["request_type"] = rpc.input.ident.name @@ -946,10 +954,8 @@ def generate_sample_specs(api_schema: api.API, *, opts) -> Generator[Dict[str, A for service_name, service in gapic_metadata.services.items(): api_short_name = api_schema.services[f"{api_schema.naming.proto_package}.{service_name}"].shortname - for transport_type, client in service.clients.items(): - if transport_type == "grpc-async": - # TODO(busunkim): Enable generation of async samples - continue + for transport, client in service.clients.items(): + transport_type = "async" if transport == api.TRANSPORT_GRPC_ASYNC else "sync" for rpc_name, method_list in client.rpcs.items(): # Region Tag Format: # [{START|END} ${apishortname}_generated_${api}_${apiVersion}_${serviceName}_${rpcName}_{sync|async}_${overloadDisambiguation}] @@ -957,6 +963,7 @@ def generate_sample_specs(api_schema: api.API, *, opts) -> Generator[Dict[str, A spec = { "sample_type": "standalone", "rpc": rpc_name, + "transport": transport, "request": [], # response is populated in `preprocess_sample` "service": f"{api_schema.naming.proto_package}.{service_name}", diff --git a/gapic/schema/api.py b/gapic/schema/api.py index 8af8933e8d..cdfb5ca6e7 100644 --- a/gapic/schema/api.py +++ b/gapic/schema/api.py @@ -45,6 +45,11 @@ from gapic.utils import RESERVED_NAMES +TRANSPORT_GRPC = "grpc" +TRANSPORT_GRPC_ASYNC = "grpc-async" +TRANSPORT_REST = "rest" + + @dataclasses.dataclass(frozen=True) class Proto: """A representation of a particular proto file within an API.""" @@ -414,11 +419,12 @@ def gapic_metadata(self, options: Options) -> gapic_metadata_pb2.GapicMetadata: # This assumes the options are generated by the class method factory. transports = [] if "grpc" in options.transport: - transports.append(("grpc", service.client_name)) - transports.append(("grpc-async", service.async_client_name)) + transports.append((TRANSPORT_GRPC, service.client_name)) + transports.append( + (TRANSPORT_GRPC_ASYNC, service.async_client_name)) if "rest" in options.transport: - transports.append(("rest", service.client_name)) + transports.append((TRANSPORT_REST, service.client_name)) methods = sorted(service.methods.values(), key=lambda m: m.name) for tprt, client_name in transports: diff --git a/gapic/templates/examples/feature_fragments.j2 b/gapic/templates/examples/feature_fragments.j2 index 7525c308f8..502d68fa60 100644 --- a/gapic/templates/examples/feature_fragments.j2 +++ b/gapic/templates/examples/feature_fragments.j2 @@ -202,8 +202,13 @@ request=request {% endmacro %} -{% macro render_method_call(sample, calling_form, calling_form_enum) %} +{% macro render_method_call(sample, calling_form, calling_form_enum, transport) %} {# Note: this doesn't deal with enums or unions #} +{# LROs return operation objects and paged requests return pager objects #} +{% if transport == "grpc-async" and calling_form not in +[calling_form_enum.LongRunningRequestPromise, calling_form_enum.RequestPagedAll] %} +await{{ " "}} +{%- endif -%} {% if calling_form in [calling_form_enum.RequestStreamingBidi, calling_form_enum.RequestStreamingClient] %} client.{{ sample.rpc|snake_case }}([{{ render_request_params(sample.request.request_list)|trim }}]) @@ -215,7 +220,7 @@ client.{{ sample.rpc|snake_case }}({{ render_request_params_unary(sample.request {# Setting up the method invocation is the responsibility of the caller: #} {# it's just easier to set up client side streaming and other things from outside this macro. #} -{% macro render_calling_form(method_invocation_text, calling_form, calling_form_enum, response_statements ) %} +{% macro render_calling_form(method_invocation_text, calling_form, calling_form_enum, transport, response_statements ) %} # Make the request {% if calling_form == calling_form_enum.Request %} response = {{ method_invocation_text|trim }} @@ -228,13 +233,13 @@ response = {{ method_invocation_text|trim }} {% endif %} {% elif calling_form == calling_form_enum.RequestPagedAll %} page_result = {{ method_invocation_text|trim }} -for response in page_result: +{% if transport == "grpc-async" %}async {% endif %}for response in page_result: {% for statement in response_statements %} {{ dispatch_statement(statement)|trim }} {% endfor %} {% elif calling_form == calling_form_enum.RequestPaged %} page_result = {{ method_invocation_text|trim }} -for page in page_result.pages(): +{% if transport == "grpc-async" %}async {% endif %}for page in page_result.pages(): for response in page: {% for statement in response_statements %} {{ dispatch_statement(statement)|trim }} @@ -242,7 +247,7 @@ for page in page_result.pages(): {% elif calling_form in [calling_form_enum.RequestStreamingServer, calling_form_enum.RequestStreamingBidi] %} stream = {{ method_invocation_text|trim }} -for response in stream: +{% if transport == "grpc-async" %}async {% endif %}for response in stream: {% for statement in response_statements %} {{ dispatch_statement(statement)|trim }} {% endfor %} @@ -251,7 +256,7 @@ operation = {{ method_invocation_text|trim }} print("Waiting for operation to complete...") -response = operation.result() +response = {% if transport == "grpc-async" %}await {% endif %}operation.result() {% for statement in response_statements %} {{ dispatch_statement(statement)|trim }} {% endfor %} diff --git a/gapic/templates/examples/sample.py.j2 b/gapic/templates/examples/sample.py.j2 index 79614d71a3..54db08ca21 100644 --- a/gapic/templates/examples/sample.py.j2 +++ b/gapic/templates/examples/sample.py.j2 @@ -31,13 +31,13 @@ from {{ sample.module_namespace|join(".") }} import {{ sample.module_name }} {# also need calling form #} -def sample_{{ frags.render_method_name(sample.rpc)|trim }}({{ frags.print_input_params(sample.request)|trim }}): +{% if sample.transport == "grpc-async" %}async {% endif %}def sample_{{ frags.render_method_name(sample.rpc)|trim }}({{ frags.print_input_params(sample.request)|trim }}): """{{ sample.description }}""" {{ frags.render_client_setup(sample.module_name, sample.client_name)|indent }} {{ frags.render_request_setup(sample.request, sample.module_name, sample.request_type)|indent }} - {% with method_call = frags.render_method_call(sample, calling_form, calling_form_enum) %} - {{ frags.render_calling_form(method_call, calling_form, calling_form_enum, sample.response)|indent -}} + {% with method_call = frags.render_method_call(sample, calling_form, calling_form_enum, sample.transport) %} + {{ frags.render_calling_form(method_call, calling_form, calling_form_enum, sample.transport, sample.response)|indent -}} {% endwith %} # [END {{ sample.id }}] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_async.py new file mode 100644 index 0000000000..e5c7daddc0 --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for AnalyzeIamPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_async] +from google.cloud import asset_v1 + + +async def sample_analyze_iam_policy(): + """Snippet for analyze_iam_policy""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.AnalyzeIamPolicyRequest( + ) + + # Make the request + response = await client.analyze_iam_policy(request=request) + + # Handle response + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_async.py new file mode 100644 index 0000000000..81abec2403 --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for AnalyzeIamPolicyLongrunning +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_async] +from google.cloud import asset_v1 + + +async def sample_analyze_iam_policy_longrunning(): + """Snippet for analyze_iam_policy_longrunning""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.AnalyzeIamPolicyLongrunningRequest( + ) + + # Make the request + operation = client.analyze_iam_policy_longrunning(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py similarity index 97% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py index e7a432399b..c59ff3936a 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_grpc] +# [START cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_sync] from google.cloud import asset_v1 @@ -45,4 +45,4 @@ def sample_analyze_iam_policy_longrunning(): response = operation.result() print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_grpc] +# [END cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py similarity index 98% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py index 9bbac93d77..188cc12bca 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_grpc] +# [START cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_sync] from google.cloud import asset_v1 @@ -43,4 +43,4 @@ def sample_analyze_iam_policy(): # Handle response print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_grpc] +# [END cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_async.py new file mode 100644 index 0000000000..29da9244a8 --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchGetAssetsHistory +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_async] +from google.cloud import asset_v1 + + +async def sample_batch_get_assets_history(): + """Snippet for batch_get_assets_history""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.BatchGetAssetsHistoryRequest( + ) + + # Make the request + response = await client.batch_get_assets_history(request=request) + + # Handle response + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py similarity index 98% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py index 4a691dd099..8fd8b83c10 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_grpc] +# [START cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_sync] from google.cloud import asset_v1 @@ -43,4 +43,4 @@ def sample_batch_get_assets_history(): # Handle response print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_grpc] +# [END cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_async.py new file mode 100644 index 0000000000..e6a4c3b8dd --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateFeed +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_CreateFeed_async] +from google.cloud import asset_v1 + + +async def sample_create_feed(): + """Snippet for create_feed""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.CreateFeedRequest( + ) + + # Make the request + response = await client.create_feed(request=request) + + # Handle response + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_CreateFeed_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_sync.py similarity index 90% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_sync.py index d4afa1d05b..c41f2d9289 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_CreateFeed_grpc] +# [START cloudasset_generated_asset_v1_AssetService_CreateFeed_sync] from google.cloud import asset_v1 @@ -43,4 +43,4 @@ def sample_create_feed(): # Handle response print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_CreateFeed_grpc] +# [END cloudasset_generated_asset_v1_AssetService_CreateFeed_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_async.py new file mode 100644 index 0000000000..8e10aedf8d --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteFeed +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_DeleteFeed_async] +from google.cloud import asset_v1 + + +async def sample_delete_feed(): + """Snippet for delete_feed""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.DeleteFeedRequest( + ) + + # Make the request + response = await client.delete_feed(request=request) + + +# [END cloudasset_generated_asset_v1_AssetService_DeleteFeed_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py similarity index 90% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py index f654233fd9..6f28f8c5de 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_DeleteFeed_grpc] +# [START cloudasset_generated_asset_v1_AssetService_DeleteFeed_sync] from google.cloud import asset_v1 @@ -41,4 +41,4 @@ def sample_delete_feed(): response = client.delete_feed(request=request) -# [END cloudasset_generated_asset_v1_AssetService_DeleteFeed_grpc] +# [END cloudasset_generated_asset_v1_AssetService_DeleteFeed_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_async.py new file mode 100644 index 0000000000..776264c0dd --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ExportAssets +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_ExportAssets_async] +from google.cloud import asset_v1 + + +async def sample_export_assets(): + """Snippet for export_assets""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.ExportAssetsRequest( + ) + + # Make the request + operation = client.export_assets(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_ExportAssets_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_sync.py similarity index 95% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_sync.py index ef04466664..e274800452 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_ExportAssets_grpc] +# [START cloudasset_generated_asset_v1_AssetService_ExportAssets_sync] from google.cloud import asset_v1 @@ -45,4 +45,4 @@ def sample_export_assets(): response = operation.result() print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_ExportAssets_grpc] +# [END cloudasset_generated_asset_v1_AssetService_ExportAssets_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_async.py new file mode 100644 index 0000000000..3c10ab1e18 --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetFeed +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_GetFeed_async] +from google.cloud import asset_v1 + + +async def sample_get_feed(): + """Snippet for get_feed""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.GetFeedRequest( + ) + + # Make the request + response = await client.get_feed(request=request) + + # Handle response + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_GetFeed_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_sync.py similarity index 91% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_sync.py index 4c04e1cd57..63dbf0c90c 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_GetFeed_grpc] +# [START cloudasset_generated_asset_v1_AssetService_GetFeed_sync] from google.cloud import asset_v1 @@ -43,4 +43,4 @@ def sample_get_feed(): # Handle response print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_GetFeed_grpc] +# [END cloudasset_generated_asset_v1_AssetService_GetFeed_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_async.py new file mode 100644 index 0000000000..a15ad4a113 --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListFeeds +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_ListFeeds_async] +from google.cloud import asset_v1 + + +async def sample_list_feeds(): + """Snippet for list_feeds""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.ListFeedsRequest( + ) + + # Make the request + response = await client.list_feeds(request=request) + + # Handle response + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_ListFeeds_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py similarity index 90% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py index b5b759711e..2ad102f795 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_ListFeeds_grpc] +# [START cloudasset_generated_asset_v1_AssetService_ListFeeds_sync] from google.cloud import asset_v1 @@ -43,4 +43,4 @@ def sample_list_feeds(): # Handle response print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_ListFeeds_grpc] +# [END cloudasset_generated_asset_v1_AssetService_ListFeeds_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_async.py new file mode 100644 index 0000000000..b99fc9ac64 --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SearchAllIamPolicies +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_async] +from google.cloud import asset_v1 + + +async def sample_search_all_iam_policies(): + """Snippet for search_all_iam_policies""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.SearchAllIamPoliciesRequest( + ) + + # Make the request + page_result = client.search_all_iam_policies(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py similarity index 98% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py index c3582046ca..e142ae2fcb 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_grpc] +# [START cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_sync] from google.cloud import asset_v1 @@ -42,4 +42,4 @@ def sample_search_all_iam_policies(): for response in page_result: print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_grpc] +# [END cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_async.py new file mode 100644 index 0000000000..2fc426361c --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SearchAllResources +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_SearchAllResources_async] +from google.cloud import asset_v1 + + +async def sample_search_all_resources(): + """Snippet for search_all_resources""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.SearchAllResourcesRequest( + ) + + # Make the request + page_result = client.search_all_resources(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_SearchAllResources_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py similarity index 98% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py index 9e07726939..85d6799a35 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_SearchAllResources_grpc] +# [START cloudasset_generated_asset_v1_AssetService_SearchAllResources_sync] from google.cloud import asset_v1 @@ -42,4 +42,4 @@ def sample_search_all_resources(): for response in page_result: print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_SearchAllResources_grpc] +# [END cloudasset_generated_asset_v1_AssetService_SearchAllResources_sync] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_async.py new file mode 100644 index 0000000000..2386c5443d --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateFeed +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-asset + + +# [START cloudasset_generated_asset_v1_AssetService_UpdateFeed_async] +from google.cloud import asset_v1 + + +async def sample_update_feed(): + """Snippet for update_feed""" + + # Create a client + client = asset_v1.AssetServiceAsyncClient() + + # Initialize request argument(s) + request = asset_v1.UpdateFeedRequest( + ) + + # Make the request + response = await client.update_feed(request=request) + + # Handle response + print("{}".format(response)) + +# [END cloudasset_generated_asset_v1_AssetService_UpdateFeed_async] diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_grpc.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_sync.py similarity index 90% rename from tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_grpc.py rename to tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_sync.py index e383583545..4dc4915cf5 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_grpc.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-asset -# [START cloudasset_generated_asset_v1_AssetService_UpdateFeed_grpc] +# [START cloudasset_generated_asset_v1_AssetService_UpdateFeed_sync] from google.cloud import asset_v1 @@ -43,4 +43,4 @@ def sample_update_feed(): # Handle response print("{}".format(response)) -# [END cloudasset_generated_asset_v1_AssetService_UpdateFeed_grpc] +# [END cloudasset_generated_asset_v1_AssetService_UpdateFeed_sync] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_async.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_async.py new file mode 100644 index 0000000000..de3341a690 --- /dev/null +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GenerateAccessToken +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-iam-credentials + + +# [START iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_async] +from google.iam import credentials_v1 + + +async def sample_generate_access_token(): + """Snippet for generate_access_token""" + + # Create a client + client = credentials_v1.IAMCredentialsAsyncClient() + + # Initialize request argument(s) + request = credentials_v1.GenerateAccessTokenRequest( + ) + + # Make the request + response = await client.generate_access_token(request=request) + + # Handle response + print("{}".format(response)) + +# [END iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_async] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_grpc.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py similarity index 96% rename from tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_grpc.py rename to tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py index b5c1028a86..24e4484bfc 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_grpc.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-iam-credentials -# [START iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_grpc] +# [START iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_sync] from google.iam import credentials_v1 @@ -43,4 +43,4 @@ def sample_generate_access_token(): # Handle response print("{}".format(response)) -# [END iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_grpc] +# [END iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_sync] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_async.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_async.py new file mode 100644 index 0000000000..4417fcb6bb --- /dev/null +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GenerateIdToken +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-iam-credentials + + +# [START iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_async] +from google.iam import credentials_v1 + + +async def sample_generate_id_token(): + """Snippet for generate_id_token""" + + # Create a client + client = credentials_v1.IAMCredentialsAsyncClient() + + # Initialize request argument(s) + request = credentials_v1.GenerateIdTokenRequest( + ) + + # Make the request + response = await client.generate_id_token(request=request) + + # Handle response + print("{}".format(response)) + +# [END iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_async] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_grpc.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py similarity index 97% rename from tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_grpc.py rename to tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py index 2dc2d87112..e23294e559 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_grpc.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-iam-credentials -# [START iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_grpc] +# [START iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_sync] from google.iam import credentials_v1 @@ -43,4 +43,4 @@ def sample_generate_id_token(): # Handle response print("{}".format(response)) -# [END iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_grpc] +# [END iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_sync] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_async.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_async.py new file mode 100644 index 0000000000..3732426ff8 --- /dev/null +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SignBlob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-iam-credentials + + +# [START iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_async] +from google.iam import credentials_v1 + + +async def sample_sign_blob(): + """Snippet for sign_blob""" + + # Create a client + client = credentials_v1.IAMCredentialsAsyncClient() + + # Initialize request argument(s) + request = credentials_v1.SignBlobRequest( + ) + + # Make the request + response = await client.sign_blob(request=request) + + # Handle response + print("{}".format(response)) + +# [END iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_async] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_grpc.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py similarity index 98% rename from tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_grpc.py rename to tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py index 6d013e7434..51312014ff 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_grpc.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-iam-credentials -# [START iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_grpc] +# [START iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_sync] from google.iam import credentials_v1 @@ -43,4 +43,4 @@ def sample_sign_blob(): # Handle response print("{}".format(response)) -# [END iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_grpc] +# [END iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_sync] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_async.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_async.py new file mode 100644 index 0000000000..ce4303485a --- /dev/null +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SignJwt +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-iam-credentials + + +# [START iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_async] +from google.iam import credentials_v1 + + +async def sample_sign_jwt(): + """Snippet for sign_jwt""" + + # Create a client + client = credentials_v1.IAMCredentialsAsyncClient() + + # Initialize request argument(s) + request = credentials_v1.SignJwtRequest( + ) + + # Make the request + response = await client.sign_jwt(request=request) + + # Handle response + print("{}".format(response)) + +# [END iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_async] diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_grpc.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py similarity index 98% rename from tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_grpc.py rename to tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py index 530251cf57..22b8600917 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_grpc.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-iam-credentials -# [START iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_grpc] +# [START iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_sync] from google.iam import credentials_v1 @@ -43,4 +43,4 @@ def sample_sign_jwt(): # Handle response print("{}".format(response)) -# [END iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_grpc] +# [END iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_async.py new file mode 100644 index 0000000000..4cb0f540ec --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateBucket +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_CreateBucket_async] +from google.cloud import logging_v2 + + +async def sample_create_bucket(): + """Snippet for create_bucket""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CreateBucketRequest( + ) + + # Make the request + response = await client.create_bucket(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_CreateBucket_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_sync.py index c74aa5daa6..004ee0a486 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_CreateBucket_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_CreateBucket_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_create_bucket(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_CreateBucket_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_CreateBucket_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_async.py new file mode 100644 index 0000000000..1d0523610f --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_async] +from google.cloud import logging_v2 + + +async def sample_create_exclusion(): + """Snippet for create_exclusion""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CreateExclusionRequest( + ) + + # Make the request + response = await client.create_exclusion(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py index e0f6f874ea..ce102ad991 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_create_exclusion(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_async.py new file mode 100644 index 0000000000..4678b4314f --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_CreateSink_async] +from google.cloud import logging_v2 + + +async def sample_create_sink(): + """Snippet for create_sink""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CreateSinkRequest( + ) + + # Make the request + response = await client.create_sink(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_CreateSink_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_sync.py index 1f32e69be9..f47adb78d3 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_CreateSink_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_CreateSink_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_create_sink(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_CreateSink_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_CreateSink_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_async.py new file mode 100644 index 0000000000..4fbcdd61a8 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_CreateView_async] +from google.cloud import logging_v2 + + +async def sample_create_view(): + """Snippet for create_view""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CreateViewRequest( + ) + + # Make the request + response = await client.create_view(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_CreateView_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_sync.py index f1754665b4..eefdb75b88 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_CreateView_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_CreateView_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_create_view(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_CreateView_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_CreateView_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_async.py new file mode 100644 index 0000000000..8ca8c4748e --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteBucket +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_async] +from google.cloud import logging_v2 + + +async def sample_delete_bucket(): + """Snippet for delete_bucket""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteBucketRequest( + ) + + # Make the request + response = await client.delete_bucket(request=request) + + +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py index 0f951bf249..9616621b4e 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_sync] from google.cloud import logging_v2 @@ -41,4 +41,4 @@ def sample_delete_bucket(): response = client.delete_bucket(request=request) -# [END logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_async.py new file mode 100644 index 0000000000..0e8df5d06c --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_async] +from google.cloud import logging_v2 + + +async def sample_delete_exclusion(): + """Snippet for delete_exclusion""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteExclusionRequest( + ) + + # Make the request + response = await client.delete_exclusion(request=request) + + +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py index 3a45b831e1..0268e93f28 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_sync] from google.cloud import logging_v2 @@ -41,4 +41,4 @@ def sample_delete_exclusion(): response = client.delete_exclusion(request=request) -# [END logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_async.py new file mode 100644 index 0000000000..d1aaaf9ca5 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteSink_async] +from google.cloud import logging_v2 + + +async def sample_delete_sink(): + """Snippet for delete_sink""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteSinkRequest( + ) + + # Make the request + response = await client.delete_sink(request=request) + + +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteSink_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_sync.py index 67df1f2f72..6bdc8b65dc 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_DeleteSink_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteSink_sync] from google.cloud import logging_v2 @@ -41,4 +41,4 @@ def sample_delete_sink(): response = client.delete_sink(request=request) -# [END logging_generated_logging_v2_ConfigServiceV2_DeleteSink_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteSink_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_async.py new file mode 100644 index 0000000000..e9b1a1255c --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteView_async] +from google.cloud import logging_v2 + + +async def sample_delete_view(): + """Snippet for delete_view""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteViewRequest( + ) + + # Make the request + response = await client.delete_view(request=request) + + +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteView_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_sync.py index d18f27c1bd..a27f4604d3 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_DeleteView_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_DeleteView_sync] from google.cloud import logging_v2 @@ -41,4 +41,4 @@ def sample_delete_view(): response = client.delete_view(request=request) -# [END logging_generated_logging_v2_ConfigServiceV2_DeleteView_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_DeleteView_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_async.py new file mode 100644 index 0000000000..bf65579867 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetBucket +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_GetBucket_async] +from google.cloud import logging_v2 + + +async def sample_get_bucket(): + """Snippet for get_bucket""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetBucketRequest( + ) + + # Make the request + response = await client.get_bucket(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_GetBucket_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_sync.py index 0294fab026..80470bf3c4 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_GetBucket_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_GetBucket_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_get_bucket(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_GetBucket_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_GetBucket_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_async.py new file mode 100644 index 0000000000..ece79ce221 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCmekSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_async] +from google.cloud import logging_v2 + + +async def sample_get_cmek_settings(): + """Snippet for get_cmek_settings""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetCmekSettingsRequest( + ) + + # Make the request + response = await client.get_cmek_settings(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py index cd2a590033..19cef44934 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_get_cmek_settings(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_async.py new file mode 100644 index 0000000000..9ce42101f1 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_GetExclusion_async] +from google.cloud import logging_v2 + + +async def sample_get_exclusion(): + """Snippet for get_exclusion""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetExclusionRequest( + ) + + # Make the request + response = await client.get_exclusion(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_GetExclusion_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py index c28b3ba3cd..7712065b80 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_GetExclusion_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_GetExclusion_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_get_exclusion(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_GetExclusion_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_GetExclusion_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_async.py new file mode 100644 index 0000000000..b1a69a1d6f --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_GetSink_async] +from google.cloud import logging_v2 + + +async def sample_get_sink(): + """Snippet for get_sink""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetSinkRequest( + ) + + # Make the request + response = await client.get_sink(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_GetSink_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_sync.py similarity index 90% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_sync.py index 2a70061ee4..e1d4ed0b81 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_GetSink_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_GetSink_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_get_sink(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_GetSink_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_GetSink_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_async.py new file mode 100644 index 0000000000..5594e7ac23 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_GetView_async] +from google.cloud import logging_v2 + + +async def sample_get_view(): + """Snippet for get_view""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetViewRequest( + ) + + # Make the request + response = await client.get_view(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_GetView_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_sync.py similarity index 90% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_sync.py index d736bc227d..4865050cd9 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_GetView_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_GetView_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_get_view(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_GetView_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_GetView_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_async.py new file mode 100644 index 0000000000..ef7e8ba87a --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListBuckets +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_ListBuckets_async] +from google.cloud import logging_v2 + + +async def sample_list_buckets(): + """Snippet for list_buckets""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListBucketsRequest( + ) + + # Make the request + page_result = client.list_buckets(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_ListBuckets_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_sync.py similarity index 99% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_sync.py index 9dd1ba5d9e..2c1ea9332d 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_ListBuckets_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_ListBuckets_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_buckets(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_ListBuckets_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_ListBuckets_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_async.py new file mode 100644 index 0000000000..c3d7f9165b --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListExclusions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_ListExclusions_async] +from google.cloud import logging_v2 + + +async def sample_list_exclusions(): + """Snippet for list_exclusions""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListExclusionsRequest( + ) + + # Make the request + page_result = client.list_exclusions(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_ListExclusions_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py index a6a9814d8f..255e4851e4 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_ListExclusions_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_ListExclusions_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_exclusions(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_ListExclusions_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_ListExclusions_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_async.py new file mode 100644 index 0000000000..98d31d2535 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListSinks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_ListSinks_async] +from google.cloud import logging_v2 + + +async def sample_list_sinks(): + """Snippet for list_sinks""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListSinksRequest( + ) + + # Make the request + page_result = client.list_sinks(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_ListSinks_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_sync.py index af1edb26f0..d911ed8ed1 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_ListSinks_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_ListSinks_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_sinks(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_ListSinks_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_ListSinks_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_async.py new file mode 100644 index 0000000000..7a24536f99 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListViews +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_ListViews_async] +from google.cloud import logging_v2 + + +async def sample_list_views(): + """Snippet for list_views""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListViewsRequest( + ) + + # Make the request + page_result = client.list_views(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_ListViews_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_sync.py index b436c1c780..b87a931556 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_ListViews_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_ListViews_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_views(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_ListViews_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_ListViews_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_async.py new file mode 100644 index 0000000000..c0a8f1efa4 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UndeleteBucket +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_async] +from google.cloud import logging_v2 + + +async def sample_undelete_bucket(): + """Snippet for undelete_bucket""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UndeleteBucketRequest( + ) + + # Make the request + response = await client.undelete_bucket(request=request) + + +# [END logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py index 37f0c8a788..8a4968c9f7 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_sync] from google.cloud import logging_v2 @@ -41,4 +41,4 @@ def sample_undelete_bucket(): response = client.undelete_bucket(request=request) -# [END logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_async.py new file mode 100644 index 0000000000..423986e3fc --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateBucket +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_async] +from google.cloud import logging_v2 + + +async def sample_update_bucket(): + """Snippet for update_bucket""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateBucketRequest( + ) + + # Make the request + response = await client.update_bucket(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_sync.py index ceb6d9f132..4b6a11c717 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_update_bucket(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_async.py new file mode 100644 index 0000000000..67a9e4f2bc --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCmekSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_async] +from google.cloud import logging_v2 + + +async def sample_update_cmek_settings(): + """Snippet for update_cmek_settings""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateCmekSettingsRequest( + ) + + # Make the request + response = await client.update_cmek_settings(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py index 1d476684f1..568a350a7b 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_update_cmek_settings(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_async.py new file mode 100644 index 0000000000..7f13ad361e --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_async] +from google.cloud import logging_v2 + + +async def sample_update_exclusion(): + """Snippet for update_exclusion""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateExclusionRequest( + ) + + # Make the request + response = await client.update_exclusion(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py index 7f115341b2..bc48f0654a 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_update_exclusion(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_async.py new file mode 100644 index 0000000000..a5d122924f --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateSink_async] +from google.cloud import logging_v2 + + +async def sample_update_sink(): + """Snippet for update_sink""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateSinkRequest( + ) + + # Make the request + response = await client.update_sink(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateSink_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_sync.py index aa43c457ae..773e439985 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_UpdateSink_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateSink_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_update_sink(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_UpdateSink_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateSink_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_async.py new file mode 100644 index 0000000000..0eda6b705c --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateView_async] +from google.cloud import logging_v2 + + +async def sample_update_view(): + """Snippet for update_view""" + + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateViewRequest( + ) + + # Make the request + response = await client.update_view(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateView_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_sync.py index 982d897ac1..bd1ad230f7 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_ConfigServiceV2_UpdateView_grpc] +# [START logging_generated_logging_v2_ConfigServiceV2_UpdateView_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_update_view(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_ConfigServiceV2_UpdateView_grpc] +# [END logging_generated_logging_v2_ConfigServiceV2_UpdateView_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_async.py new file mode 100644 index 0000000000..b317c8d26c --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteLog +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_LoggingServiceV2_DeleteLog_async] +from google.cloud import logging_v2 + + +async def sample_delete_log(): + """Snippet for delete_log""" + + # Create a client + client = logging_v2.LoggingServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteLogRequest( + ) + + # Make the request + response = await client.delete_log(request=request) + + +# [END logging_generated_logging_v2_LoggingServiceV2_DeleteLog_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_sync.py index 1e28c486ee..0470d72af8 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_LoggingServiceV2_DeleteLog_grpc] +# [START logging_generated_logging_v2_LoggingServiceV2_DeleteLog_sync] from google.cloud import logging_v2 @@ -41,4 +41,4 @@ def sample_delete_log(): response = client.delete_log(request=request) -# [END logging_generated_logging_v2_LoggingServiceV2_DeleteLog_grpc] +# [END logging_generated_logging_v2_LoggingServiceV2_DeleteLog_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_async.py new file mode 100644 index 0000000000..771ba15974 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListLogEntries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_async] +from google.cloud import logging_v2 + + +async def sample_list_log_entries(): + """Snippet for list_log_entries""" + + # Create a client + client = logging_v2.LoggingServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListLogEntriesRequest( + ) + + # Make the request + page_result = client.list_log_entries(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py index 4d5d9ec2a7..79aa53d23d 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_grpc] +# [START logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_log_entries(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_grpc] +# [END logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_async.py new file mode 100644 index 0000000000..f9b2685a7d --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListLogs +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_LoggingServiceV2_ListLogs_async] +from google.cloud import logging_v2 + + +async def sample_list_logs(): + """Snippet for list_logs""" + + # Create a client + client = logging_v2.LoggingServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListLogsRequest( + ) + + # Make the request + page_result = client.list_logs(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_LoggingServiceV2_ListLogs_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_sync.py similarity index 94% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_sync.py index 082e37a62d..2515bc936c 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_LoggingServiceV2_ListLogs_grpc] +# [START logging_generated_logging_v2_LoggingServiceV2_ListLogs_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_logs(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_LoggingServiceV2_ListLogs_grpc] +# [END logging_generated_logging_v2_LoggingServiceV2_ListLogs_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_async.py new file mode 100644 index 0000000000..8ecd94e6d8 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListMonitoredResourceDescriptors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_async] +from google.cloud import logging_v2 + + +async def sample_list_monitored_resource_descriptors(): + """Snippet for list_monitored_resource_descriptors""" + + # Create a client + client = logging_v2.LoggingServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListMonitoredResourceDescriptorsRequest( + ) + + # Make the request + page_result = client.list_monitored_resource_descriptors(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py similarity index 96% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py index ea3f250f8c..5ca468a3a1 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_grpc] +# [START logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_monitored_resource_descriptors(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_grpc] +# [END logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_async.py new file mode 100644 index 0000000000..6ee5862d94 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TailLogEntries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_async] +from google.cloud import logging_v2 + + +async def sample_tail_log_entries(): + """Snippet for tail_log_entries""" + + # Create a client + client = logging_v2.LoggingServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.TailLogEntriesRequest( + ) + + # Make the request + stream = await client.tail_log_entries([]) + async for response in stream: + print("{}".format(response)) + +# [END logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py index 5b92819f1f..442a1f3cac 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_grpc] +# [START logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_tail_log_entries(): for response in stream: print("{}".format(response)) -# [END logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_grpc] +# [END logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_async.py new file mode 100644 index 0000000000..da4353446d --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for WriteLogEntries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_async] +from google.cloud import logging_v2 + + +async def sample_write_log_entries(): + """Snippet for write_log_entries""" + + # Create a client + client = logging_v2.LoggingServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.WriteLogEntriesRequest( + ) + + # Make the request + response = await client.write_log_entries(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py index 466eb64175..a74258a1de 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_grpc] +# [START logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_write_log_entries(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_grpc] +# [END logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_async.py new file mode 100644 index 0000000000..dc77adacf5 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_async] +from google.cloud import logging_v2 + + +async def sample_create_log_metric(): + """Snippet for create_log_metric""" + + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CreateLogMetricRequest( + ) + + # Make the request + response = await client.create_log_metric(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py index 03abbe60d5..61131f6bdc 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_grpc] +# [START logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_create_log_metric(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_grpc] +# [END logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_async.py new file mode 100644 index 0000000000..939087d191 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_async] +from google.cloud import logging_v2 + + +async def sample_delete_log_metric(): + """Snippet for delete_log_metric""" + + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteLogMetricRequest( + ) + + # Make the request + response = await client.delete_log_metric(request=request) + + +# [END logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py index d940d3619e..8a0451c319 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_grpc] +# [START logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_sync] from google.cloud import logging_v2 @@ -41,4 +41,4 @@ def sample_delete_log_metric(): response = client.delete_log_metric(request=request) -# [END logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_grpc] +# [END logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_async.py new file mode 100644 index 0000000000..64eb3f59f4 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_async] +from google.cloud import logging_v2 + + +async def sample_get_log_metric(): + """Snippet for get_log_metric""" + + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetLogMetricRequest( + ) + + # Make the request + response = await client.get_log_metric(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py index 9d14540d0d..7115ee688b 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_grpc] +# [START logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_get_log_metric(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_grpc] +# [END logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_async.py new file mode 100644 index 0000000000..9acfc76ee8 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListLogMetrics +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_async] +from google.cloud import logging_v2 + + +async def sample_list_log_metrics(): + """Snippet for list_log_metrics""" + + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListLogMetricsRequest( + ) + + # Make the request + page_result = client.list_log_metrics(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py index 5e6f0c09d0..702a286711 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_grpc] +# [START logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_sync] from google.cloud import logging_v2 @@ -42,4 +42,4 @@ def sample_list_log_metrics(): for response in page_result: print("{}".format(response)) -# [END logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_grpc] +# [END logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_sync] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_async.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_async.py new file mode 100644 index 0000000000..c25de0cd5f --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_async] +from google.cloud import logging_v2 + + +async def sample_update_log_metric(): + """Snippet for update_log_metric""" + + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateLogMetricRequest( + ) + + # Make the request + response = await client.update_log_metric(request=request) + + # Handle response + print("{}".format(response)) + +# [END logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_async] diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_grpc.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py similarity index 98% rename from tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_grpc.py rename to tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py index 51f9396d3a..89167019ac 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_grpc.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-logging -# [START logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_grpc] +# [START logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_sync] from google.cloud import logging_v2 @@ -43,4 +43,4 @@ def sample_update_log_metric(): # Handle response print("{}".format(response)) -# [END logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_grpc] +# [END logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_async.py new file mode 100644 index 0000000000..dbfed3042b --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_CreateInstance_async] +from google.cloud import redis_v1 + + +async def sample_create_instance(): + """Snippet for create_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.CreateInstanceRequest( + ) + + # Make the request + operation = client.create_instance(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_CreateInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_sync.py index bf03c6c8d4..8b874ba3c9 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_CreateInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_CreateInstance_sync] from google.cloud import redis_v1 @@ -45,4 +45,4 @@ def sample_create_instance(): response = operation.result() print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_CreateInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_CreateInstance_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_async.py new file mode 100644 index 0000000000..2a706ace31 --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_DeleteInstance_async] +from google.cloud import redis_v1 + + +async def sample_delete_instance(): + """Snippet for delete_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.DeleteInstanceRequest( + ) + + # Make the request + operation = client.delete_instance(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_DeleteInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_sync.py index 76ee5fb446..f2bfcef905 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_DeleteInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_DeleteInstance_sync] from google.cloud import redis_v1 @@ -45,4 +45,4 @@ def sample_delete_instance(): response = operation.result() print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_DeleteInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_DeleteInstance_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_async.py new file mode 100644 index 0000000000..9cbe0ee552 --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ExportInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_ExportInstance_async] +from google.cloud import redis_v1 + + +async def sample_export_instance(): + """Snippet for export_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.ExportInstanceRequest( + ) + + # Make the request + operation = client.export_instance(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_ExportInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_sync.py index bb48e0954d..f6ec74e9e8 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_ExportInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_ExportInstance_sync] from google.cloud import redis_v1 @@ -45,4 +45,4 @@ def sample_export_instance(): response = operation.result() print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_ExportInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_ExportInstance_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_async.py new file mode 100644 index 0000000000..441dd31f6a --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FailoverInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_FailoverInstance_async] +from google.cloud import redis_v1 + + +async def sample_failover_instance(): + """Snippet for failover_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.FailoverInstanceRequest( + ) + + # Make the request + operation = client.failover_instance(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_FailoverInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_sync.py index acf11a5870..f80743627e 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_FailoverInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_FailoverInstance_sync] from google.cloud import redis_v1 @@ -45,4 +45,4 @@ def sample_failover_instance(): response = operation.result() print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_FailoverInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_FailoverInstance_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_async.py new file mode 100644 index 0000000000..390c4f9b1a --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_GetInstance_async] +from google.cloud import redis_v1 + + +async def sample_get_instance(): + """Snippet for get_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.GetInstanceRequest( + ) + + # Make the request + response = await client.get_instance(request=request) + + # Handle response + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_GetInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_sync.py index 4d1b9942c7..c7ee84f231 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_GetInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_GetInstance_sync] from google.cloud import redis_v1 @@ -43,4 +43,4 @@ def sample_get_instance(): # Handle response print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_GetInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_GetInstance_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_async.py new file mode 100644 index 0000000000..fff17dfa84 --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ImportInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_ImportInstance_async] +from google.cloud import redis_v1 + + +async def sample_import_instance(): + """Snippet for import_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.ImportInstanceRequest( + ) + + # Make the request + operation = client.import_instance(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_ImportInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_sync.py index 95826e9db2..19feb13215 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_ImportInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_ImportInstance_sync] from google.cloud import redis_v1 @@ -45,4 +45,4 @@ def sample_import_instance(): response = operation.result() print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_ImportInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_ImportInstance_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_async.py new file mode 100644 index 0000000000..33d0758f39 --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListInstances +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_ListInstances_async] +from google.cloud import redis_v1 + + +async def sample_list_instances(): + """Snippet for list_instances""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.ListInstancesRequest( + ) + + # Make the request + page_result = client.list_instances(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_ListInstances_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_sync.py index 1268a04014..df9296d34a 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_ListInstances_grpc] +# [START redis_generated_redis_v1_CloudRedis_ListInstances_sync] from google.cloud import redis_v1 @@ -42,4 +42,4 @@ def sample_list_instances(): for response in page_result: print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_ListInstances_grpc] +# [END redis_generated_redis_v1_CloudRedis_ListInstances_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_async.py new file mode 100644 index 0000000000..3f6263abc0 --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_UpdateInstance_async] +from google.cloud import redis_v1 + + +async def sample_update_instance(): + """Snippet for update_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.UpdateInstanceRequest( + ) + + # Make the request + operation = client.update_instance(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_UpdateInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_sync.py index 24a3d55117..e363d28c11 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_UpdateInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_UpdateInstance_sync] from google.cloud import redis_v1 @@ -45,4 +45,4 @@ def sample_update_instance(): response = operation.result() print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_UpdateInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_UpdateInstance_sync] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_async.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_async.py new file mode 100644 index 0000000000..1ae6bc3a6a --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpgradeInstance +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-redis + + +# [START redis_generated_redis_v1_CloudRedis_UpgradeInstance_async] +from google.cloud import redis_v1 + + +async def sample_upgrade_instance(): + """Snippet for upgrade_instance""" + + # Create a client + client = redis_v1.CloudRedisAsyncClient() + + # Initialize request argument(s) + request = redis_v1.UpgradeInstanceRequest( + ) + + # Make the request + operation = client.upgrade_instance(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END redis_generated_redis_v1_CloudRedis_UpgradeInstance_async] diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_grpc.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py similarity index 91% rename from tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_grpc.py rename to tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py index 0594da347e..60759777e0 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_grpc.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-redis -# [START redis_generated_redis_v1_CloudRedis_UpgradeInstance_grpc] +# [START redis_generated_redis_v1_CloudRedis_UpgradeInstance_sync] from google.cloud import redis_v1 @@ -45,4 +45,4 @@ def sample_upgrade_instance(): response = operation.result() print("{}".format(response)) -# [END redis_generated_redis_v1_CloudRedis_UpgradeInstance_grpc] +# [END redis_generated_redis_v1_CloudRedis_UpgradeInstance_sync] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_async.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_async.py new file mode 100644 index 0000000000..72a2f65950 --- /dev/null +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListResources +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install animalia-mollusca + + +# [START mollusca_generated_mollusca_v1_Snippets_ListResources_async] +from animalia import mollusca_v1 + + +async def sample_list_resources(): + """Snippet for list_resources""" + + # Create a client + client = mollusca_v1.SnippetsAsyncClient() + + # Initialize request argument(s) + request = mollusca_v1.ListResourcesRequest( + ) + + # Make the request + page_result = client.list_resources(request=request) + async for response in page_result: + print("{}".format(response)) + +# [END mollusca_generated_mollusca_v1_Snippets_ListResources_async] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_grpc.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py similarity index 91% rename from tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_grpc.py rename to tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py index 1ea032b5d9..e7423eaf3d 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_grpc.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install animalia-mollusca -# [START mollusca_generated_mollusca_v1_Snippets_ListResources_grpc] +# [START mollusca_generated_mollusca_v1_Snippets_ListResources_sync] from animalia import mollusca_v1 @@ -42,4 +42,4 @@ def sample_list_resources(): for response in page_result: print("{}".format(response)) -# [END mollusca_generated_mollusca_v1_Snippets_ListResources_grpc] +# [END mollusca_generated_mollusca_v1_Snippets_ListResources_sync] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_async.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_async.py new file mode 100644 index 0000000000..26ab1b086c --- /dev/null +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for MethodBidiStreaming +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install animalia-mollusca + + +# [START mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_async] +from animalia import mollusca_v1 + + +async def sample_method_bidi_streaming(): + """Snippet for method_bidi_streaming""" + + # Create a client + client = mollusca_v1.SnippetsAsyncClient() + + # Initialize request argument(s) + request = mollusca_v1.SignatureRequest( + ) + + # Make the request + stream = await client.method_bidi_streaming([]) + async for response in stream: + print("{}".format(response)) + +# [END mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_async] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_grpc.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py similarity index 98% rename from tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_grpc.py rename to tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py index 1c9be7560f..239eeb7763 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_grpc.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install animalia-mollusca -# [START mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_grpc] +# [START mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_sync] from animalia import mollusca_v1 @@ -42,4 +42,4 @@ def sample_method_bidi_streaming(): for response in stream: print("{}".format(response)) -# [END mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_grpc] +# [END mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_sync] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_async.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_async.py new file mode 100644 index 0000000000..3327f9a2b4 --- /dev/null +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for MethodLroSignatures +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install animalia-mollusca + + +# [START mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_async] +from animalia import mollusca_v1 + + +async def sample_method_lro_signatures(): + """Snippet for method_lro_signatures""" + + # Create a client + client = mollusca_v1.SnippetsAsyncClient() + + # Initialize request argument(s) + request = mollusca_v1.SignatureRequest( + ) + + # Make the request + operation = client.method_lro_signatures(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print("{}".format(response)) + +# [END mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_async] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_grpc.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py similarity index 98% rename from tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_grpc.py rename to tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py index 50974d82b3..af22fb4125 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_grpc.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install animalia-mollusca -# [START mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_grpc] +# [START mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_sync] from animalia import mollusca_v1 @@ -45,4 +45,4 @@ def sample_method_lro_signatures(): response = operation.result() print("{}".format(response)) -# [END mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_grpc] +# [END mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_sync] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_async.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_async.py new file mode 100644 index 0000000000..b8f4629577 --- /dev/null +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for MethodOneSignature +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install animalia-mollusca + + +# [START mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_async] +from animalia import mollusca_v1 + + +async def sample_method_one_signature(): + """Snippet for method_one_signature""" + + # Create a client + client = mollusca_v1.SnippetsAsyncClient() + + # Initialize request argument(s) + request = mollusca_v1.SignatureRequest( + ) + + # Make the request + response = await client.method_one_signature(request=request) + + # Handle response + print("{}".format(response)) + +# [END mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_async] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_grpc.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py similarity index 98% rename from tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_grpc.py rename to tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py index 9c6192b43f..e8e438f169 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_grpc.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install animalia-mollusca -# [START mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_grpc] +# [START mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_sync] from animalia import mollusca_v1 @@ -43,4 +43,4 @@ def sample_method_one_signature(): # Handle response print("{}".format(response)) -# [END mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_grpc] +# [END mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_sync] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_async.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_async.py new file mode 100644 index 0000000000..753c7666e5 --- /dev/null +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for MethodServerStreaming +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install animalia-mollusca + + +# [START mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_async] +from animalia import mollusca_v1 + + +async def sample_method_server_streaming(): + """Snippet for method_server_streaming""" + + # Create a client + client = mollusca_v1.SnippetsAsyncClient() + + # Initialize request argument(s) + request = mollusca_v1.SignatureRequest( + ) + + # Make the request + stream = await client.method_server_streaming(request=request) + async for response in stream: + print("{}".format(response)) + +# [END mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_async] diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_grpc.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py similarity index 98% rename from tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_grpc.py rename to tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py index 13913a0ed3..339623a2d6 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_grpc.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install animalia-mollusca -# [START mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_grpc] +# [START mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_sync] from animalia import mollusca_v1 @@ -42,4 +42,4 @@ def sample_method_server_streaming(): for response in stream: print("{}".format(response)) -# [END mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_grpc] +# [END mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_sync] diff --git a/tests/unit/samplegen/golden_snippets/sample_basic_async.py b/tests/unit/samplegen/golden_snippets/sample_basic_async.py new file mode 100644 index 0000000000..5aa99485ad --- /dev/null +++ b/tests/unit/samplegen/golden_snippets/sample_basic_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Classify +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install molluscs-v1-molluscclient + + +# [START mollusc_classify_sync] +from molluscs.v1 import molluscclient + + +async def sample_classify(video, location): + """Determine the full taxonomy of input mollusc""" + + # Create a client + client = molluscclient.MolluscServiceAsyncClient() + + # Initialize request argument(s) + classify_target = {} + # video = "path/to/mollusc/video.mkv" + with open(video, "rb") as f: + classify_target["video"] = f.read() + + # location = "New Zealand" + classify_target["location_annotation"] = location + + request = molluscclient.molluscs.v1.ClassifyRequest( + classify_target=classify_target, + ) + + # Make the request + response = await client.classify(request=request) + + # Handle response + print("Mollusc is a \"{}\"".format(response.taxonomy)) + +# [END mollusc_classify_sync] diff --git a/tests/unit/samplegen/test_integration.py b/tests/unit/samplegen/test_integration.py index b0fa2de221..8b88830147 100644 --- a/tests/unit/samplegen/test_integration.py +++ b/tests/unit/samplegen/test_integration.py @@ -123,6 +123,79 @@ def test_generate_sample_basic(): assert sample_str == golden_snippet("sample_basic.py") +def test_generate_sample_basic_async(): + # Note: the sample integration tests are needfully large + # and difficult to eyeball parse. They are intended to be integration tests + # that catch errors in behavior that is emergent from combining smaller features + # or in features that are sufficiently small and trivial that it doesn't make sense + # to have standalone tests. + + input_type = DummyMessage( + type="REQUEST TYPE", + fields={ + "classify_target": DummyField( + message=DummyMessage( + type="CLASSIFY TYPE", + fields={ + "video": DummyField( + message=DummyMessage(type="VIDEO TYPE"), + ), + "location_annotation": DummyField( + message=DummyMessage(type="LOCATION TYPE"), + ) + }, + ) + ) + }, + ident=DummyIdent(name="molluscs.v1.ClassifyRequest") + ) + + api_naming = naming.NewNaming( + name="MolluscClient", namespace=("molluscs", "v1")) + service = wrappers.Service( + service_pb=namedtuple('service_pb', ['name'])('MolluscService'), + methods={ + "Classify": DummyMethod( + input=input_type, + output=message_factory("$resp.taxonomy"), + flattened_fields={ + "classify_target": DummyField(name="classify_target") + } + ) + }, + visible_resources={}, + ) + + schema = DummyApiSchema( + services={"animalia.mollusca.v1.Mollusc": service}, + naming=api_naming, + ) + + sample = {"service": "animalia.mollusca.v1.Mollusc", + "rpc": "Classify", + "transport": "grpc-async", + "id": "mollusc_classify_sync", + "description": "Determine the full taxonomy of input mollusc", + "request": [ + {"field": "classify_target.video", + "value": "path/to/mollusc/video.mkv", + "input_parameter": "video", + "value_is_file": True}, + {"field": "classify_target.location_annotation", + "value": "New Zealand", + "input_parameter": "location"} + ], + "response": [{"print": ['Mollusc is a "%s"', "$resp.taxonomy"]}]} + + sample_str = samplegen.generate_sample( + sample, + schema, + env.get_template('examples/sample.py.j2') + ) + + assert sample_str == golden_snippet("sample_basic_async.py") + + def test_generate_sample_basic_unflattenable(): # Note: the sample integration tests are needfully large # and difficult to eyeball parse. They are intended to be integration tests diff --git a/tests/unit/samplegen/test_samplegen.py b/tests/unit/samplegen/test_samplegen.py index 5359840f0b..73798ce842 100644 --- a/tests/unit/samplegen/test_samplegen.py +++ b/tests/unit/samplegen/test_samplegen.py @@ -1910,15 +1910,28 @@ def test_generate_sample_spec_basic(): ] ) opts = Options.build("transport=grpc") - specs = list(samplegen.generate_sample_specs(api_schema, opts=opts)) - assert len(specs) == 1 + specs = sorted(samplegen.generate_sample_specs( + api_schema, opts=opts), key=lambda x: x["transport"]) + specs.sort(key=lambda x: x["transport"]) + assert len(specs) == 2 assert specs[0] == { "sample_type": "standalone", "rpc": "Ramshorn", + "transport": "grpc", "request": [], "service": "animalia.mollusca.v1.Squid", - "region_tag": "example_generated_mollusca_v1_Squid_Ramshorn_grpc", + "region_tag": "example_generated_mollusca_v1_Squid_Ramshorn_sync", + "description": "Snippet for ramshorn" + } + + assert specs[1] == { + "sample_type": "standalone", + "rpc": "Ramshorn", + "transport": "grpc-async", + "request": [], + "service": "animalia.mollusca.v1.Squid", + "region_tag": "example_generated_mollusca_v1_Squid_Ramshorn_async", "description": "Snippet for ramshorn" } diff --git a/tests/unit/samplegen/test_template.py b/tests/unit/samplegen/test_template.py index 0eabe9e4f0..edd7e3b0fe 100644 --- a/tests/unit/samplegen/test_template.py +++ b/tests/unit/samplegen/test_template.py @@ -700,7 +700,7 @@ def test_print_input_params(): CALLING_FORM_TEMPLATE_TEST_STR = ''' {% import "feature_fragments.j2" as frags %} {{ frags.render_calling_form("TEST_INVOCATION_TXT", calling_form, - calling_form_enum, + calling_form_enum, transport, [{"print": ["Test print statement"]}]) }} ''' @@ -715,7 +715,8 @@ def test_render_calling_form_request(): print("Test print statement") ''', calling_form_enum=CallingForm, - calling_form=CallingForm.Request) + calling_form=CallingForm.Request, + transport="grpc") def test_render_calling_form_paged_all(): @@ -727,7 +728,21 @@ def test_render_calling_form_paged_all(): print("Test print statement") ''', calling_form_enum=CallingForm, - calling_form=CallingForm.RequestPagedAll) + calling_form=CallingForm.RequestPagedAll, + transport="grpc") + + +def test_render_calling_form_paged_all_async(): + check_template(CALLING_FORM_TEMPLATE_TEST_STR, + ''' + # Make the request + page_result = TEST_INVOCATION_TXT + async for response in page_result: + print("Test print statement") + ''', + calling_form_enum=CallingForm, + calling_form=CallingForm.RequestPagedAll, + transport="grpc-async") def test_render_calling_form_paged(): @@ -740,7 +755,22 @@ def test_render_calling_form_paged(): print("Test print statement") ''', calling_form_enum=CallingForm, - calling_form=CallingForm.RequestPaged) + calling_form=CallingForm.RequestPaged, + transport="grpc") + + +def test_render_calling_form_paged_async(): + check_template(CALLING_FORM_TEMPLATE_TEST_STR, + ''' + # Make the request + page_result = TEST_INVOCATION_TXT + async for page in page_result.pages(): + for response in page: + print("Test print statement") + ''', + calling_form_enum=CallingForm, + calling_form=CallingForm.RequestPaged, + transport="grpc-async") def test_render_calling_form_streaming_server(): @@ -752,7 +782,21 @@ def test_render_calling_form_streaming_server(): print("Test print statement") ''', calling_form_enum=CallingForm, - calling_form=CallingForm.RequestStreamingServer) + calling_form=CallingForm.RequestStreamingServer, + transport="grpc") + + +def test_render_calling_form_streaming_server_async(): + check_template(CALLING_FORM_TEMPLATE_TEST_STR, + ''' + # Make the request + stream = TEST_INVOCATION_TXT + async for response in stream: + print("Test print statement") + ''', + calling_form_enum=CallingForm, + calling_form=CallingForm.RequestStreamingServer, + transport="grpc-async") def test_render_calling_form_streaming_bidi(): @@ -764,7 +808,21 @@ def test_render_calling_form_streaming_bidi(): print("Test print statement") ''', calling_form_enum=CallingForm, - calling_form=CallingForm.RequestStreamingBidi) + calling_form=CallingForm.RequestStreamingBidi, + transport="grpc") + + +def test_render_calling_form_streaming_bidi_async(): + check_template(CALLING_FORM_TEMPLATE_TEST_STR, + ''' + # Make the request + stream = TEST_INVOCATION_TXT + async for response in stream: + print("Test print statement") + ''', + calling_form_enum=CallingForm, + calling_form=CallingForm.RequestStreamingBidi, + transport="grpc-async") def test_render_calling_form_longrunning(): @@ -779,7 +837,24 @@ def test_render_calling_form_longrunning(): print("Test print statement") ''', calling_form_enum=CallingForm, - calling_form=CallingForm.LongRunningRequestPromise) + calling_form=CallingForm.LongRunningRequestPromise, + transport="grpc") + + +def test_render_calling_form_longrunning_async(): + check_template(CALLING_FORM_TEMPLATE_TEST_STR, + ''' + # Make the request + operation = TEST_INVOCATION_TXT + + print("Waiting for operation to complete...") + + response = await operation.result() + print("Test print statement") + ''', + calling_form_enum=CallingForm, + calling_form=CallingForm.LongRunningRequestPromise, + transport="grpc-async") def test_render_method_call_basic(): @@ -787,7 +862,7 @@ def test_render_method_call_basic(): ''' {% import "feature_fragments.j2" as frags %} {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, - calling_form, calling_form_enum) }} + calling_form, calling_form_enum, transport) }} ''', ''' client.categorize_mollusc(request=request) @@ -806,7 +881,37 @@ def test_render_method_call_basic(): ], ), calling_form_enum=CallingForm, - calling_form=CallingForm.Request + calling_form=CallingForm.Request, + transport="grpc" + ) + + +def test_render_method_call_basic_async(): + check_template( + ''' + {% import "feature_fragments.j2" as frags %} + {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, + calling_form, calling_form_enum, transport) }} + ''', + ''' + await client.categorize_mollusc(request=request) + ''', + request=samplegen.FullRequest( + request_list=[ + samplegen.TransformedRequest(base="video", + body=True, + single=None), + samplegen.TransformedRequest(base="audio", + body=True, + single=None), + samplegen.TransformedRequest(base="guess", + body=True, + single=None) + ], + ), + calling_form_enum=CallingForm, + calling_form=CallingForm.Request, + transport="grpc-async" ) @@ -815,7 +920,7 @@ def test_render_method_call_basic_flattenable(): ''' {% import "feature_fragments.j2" as frags %} {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, - calling_form, calling_form_enum) }} + calling_form, calling_form_enum, transport) }} ''', ''' client.categorize_mollusc(video=video, audio=audio, guess=guess) @@ -835,7 +940,8 @@ def test_render_method_call_basic_flattenable(): flattenable=True, ), calling_form_enum=CallingForm, - calling_form=CallingForm.Request + calling_form=CallingForm.Request, + transport="grpc" ) @@ -844,7 +950,7 @@ def test_render_method_call_bidi(): ''' {% import "feature_fragments.j2" as frags %} {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, - calling_form, calling_form_enum) }} + calling_form, calling_form_enum, transport) }} ''', ''' client.categorize_mollusc([video]) @@ -859,7 +965,33 @@ def test_render_method_call_bidi(): ] ), calling_form_enum=CallingForm, - calling_form=CallingForm.RequestStreamingBidi + calling_form=CallingForm.RequestStreamingBidi, + transport="grpc", + ) + + +def test_render_method_call_bidi_async(): + check_template( + ''' + {% import "feature_fragments.j2" as frags %} + {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, + calling_form, calling_form_enum, transport) }} + ''', + ''' + await client.categorize_mollusc([video]) + ''', + request=samplegen.FullRequest( + request_list=[ + samplegen.TransformedRequest( + base="video", + body=True, + single=None + ) + ] + ), + calling_form_enum=CallingForm, + calling_form=CallingForm.RequestStreamingBidi, + transport="grpc-async", ) @@ -868,7 +1000,7 @@ def test_render_method_call_client(): ''' {% import "feature_fragments.j2" as frags %} {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, - calling_form, calling_form_enum) }} + calling_form, calling_form_enum, transport) }} ''', ''' client.categorize_mollusc([video]) @@ -883,7 +1015,33 @@ def test_render_method_call_client(): ] ), calling_form_enum=CallingForm, - calling_form=CallingForm.RequestStreamingClient + calling_form=CallingForm.RequestStreamingClient, + transport="grpc", + ) + + +def test_render_method_call_client_async(): + check_template( + ''' + {% import "feature_fragments.j2" as frags %} + {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, + calling_form, calling_form_enum, transport) }} + ''', + ''' + await client.categorize_mollusc([video]) + ''', + request=samplegen.FullRequest( + request_list=[ + samplegen.TransformedRequest( + base="video", + body=True, + single=None + ) + ] + ), + calling_form_enum=CallingForm, + calling_form=CallingForm.RequestStreamingClient, + transport="grpc-async", )