From 9e46031d01edc3a461140fe3b29d8d400f5ddf86 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 18 Jan 2022 11:39:26 -0700 Subject: [PATCH] feat: generate snippet metadata (#1129) Follow up to #1121. **Main changes:** * When snippets are generated, snippet metadata is also generated. * If a method has a snippet, that snippet is included in the method docstring. **Other changes:** * Removed the method docstring in the code snippet file (line right below the method definition) since the same text is already in the comment block at the top of the file. * Removed the concept of a "standalone" sample. All generated samples are expected to be standalone. When someone wants a smaller portion of the sample (e.g., request initialization only) they should fetch it from the file by looking up the line numbers in the snippet metadata file. Other Notes: * ~It doesn't look like it's possible to do type annotations with `_pb2` types, so those are annotated as `Any`.~ It is possible to do mypy checking with https://github.com/dropbox/mypy-protobuf, but I think it will be easier make that change in a separate PR. * There are a lot of golden file updates, [this range of commits](https://github.com/googleapis/gapic-generator-python/pull/1129/files/872c156f5100f1de20631dd59d083206432db374) has _most_ of the generator and test changes. --- gapic/generator/generator.py | 75 +- gapic/samplegen/samplegen.py | 32 +- gapic/samplegen_utils/snippet_index.py | 9 +- gapic/schema/wrappers.py | 2 +- .../%sub/services/%service/async_client.py.j2 | 8 + .../%sub/services/%service/client.py.j2 | 9 + gapic/templates/examples/sample.py.j2 | 2 - .../services/asset_service/async_client.py | 265 ++ .../asset_v1/services/asset_service/client.py | 277 ++ ..._asset_service_analyze_iam_policy_async.py | 2 - ...ce_analyze_iam_policy_longrunning_async.py | 2 - ...ice_analyze_iam_policy_longrunning_sync.py | 2 - ...1_asset_service_analyze_iam_policy_sync.py | 2 - ..._service_batch_get_assets_history_async.py | 2 - ...t_service_batch_get_assets_history_sync.py | 2 - ...sset_v1_asset_service_create_feed_async.py | 2 - ...asset_v1_asset_service_create_feed_sync.py | 2 - ...sset_v1_asset_service_delete_feed_async.py | 2 - ...asset_v1_asset_service_delete_feed_sync.py | 2 - ...et_v1_asset_service_export_assets_async.py | 2 - ...set_v1_asset_service_export_assets_sync.py | 2 - ...d_asset_v1_asset_service_get_feed_async.py | 2 - ...ed_asset_v1_asset_service_get_feed_sync.py | 2 - ...sset_v1_asset_service_list_assets_async.py | 2 - ...asset_v1_asset_service_list_assets_sync.py | 2 - ...asset_v1_asset_service_list_feeds_async.py | 2 - ..._asset_v1_asset_service_list_feeds_sync.py | 2 - ...t_service_search_all_iam_policies_async.py | 2 - ...et_service_search_all_iam_policies_sync.py | 2 - ...sset_service_search_all_resources_async.py | 2 - ...asset_service_search_all_resources_sync.py | 2 - ...sset_v1_asset_service_update_feed_async.py | 2 - ...asset_v1_asset_service_update_feed_sync.py | 2 - .../snippet_metadata_asset_v1.json | 1048 ++++++ .../services/iam_credentials/async_client.py | 100 + .../services/iam_credentials/client.py | 104 + ...credentials_generate_access_token_async.py | 2 - ..._credentials_generate_access_token_sync.py | 2 - ...iam_credentials_generate_id_token_async.py | 2 - ..._iam_credentials_generate_id_token_sync.py | 2 - ...ials_v1_iam_credentials_sign_blob_async.py | 2 - ...tials_v1_iam_credentials_sign_blob_sync.py | 2 - ...tials_v1_iam_credentials_sign_jwt_async.py | 2 - ...ntials_v1_iam_credentials_sign_jwt_sync.py | 2 - .../snippet_metadata_credentials_v1.json | 360 ++ .../config_service_v2/async_client.py | 538 +++ .../services/config_service_v2/client.py | 561 ++++ .../logging_service_v2/async_client.py | 136 + .../services/logging_service_v2/client.py | 142 + .../metrics_service_v2/async_client.py | 120 + .../services/metrics_service_v2/client.py | 125 + ...2_config_service_v2_create_bucket_async.py | 2 - ...v2_config_service_v2_create_bucket_sync.py | 2 - ...onfig_service_v2_create_exclusion_async.py | 2 - ...config_service_v2_create_exclusion_sync.py | 2 - ..._v2_config_service_v2_create_sink_async.py | 2 - ...g_v2_config_service_v2_create_sink_sync.py | 2 - ..._v2_config_service_v2_create_view_async.py | 2 - ...g_v2_config_service_v2_create_view_sync.py | 2 - ...2_config_service_v2_delete_bucket_async.py | 2 - ...v2_config_service_v2_delete_bucket_sync.py | 2 - ...onfig_service_v2_delete_exclusion_async.py | 2 - ...config_service_v2_delete_exclusion_sync.py | 2 - ..._v2_config_service_v2_delete_sink_async.py | 2 - ...g_v2_config_service_v2_delete_sink_sync.py | 2 - ..._v2_config_service_v2_delete_view_async.py | 2 - ...g_v2_config_service_v2_delete_view_sync.py | 2 - ...g_v2_config_service_v2_get_bucket_async.py | 2 - ...ng_v2_config_service_v2_get_bucket_sync.py | 2 - ...nfig_service_v2_get_cmek_settings_async.py | 2 - ...onfig_service_v2_get_cmek_settings_sync.py | 2 - ...2_config_service_v2_get_exclusion_async.py | 2 - ...v2_config_service_v2_get_exclusion_sync.py | 2 - ...ing_v2_config_service_v2_get_sink_async.py | 2 - ...ging_v2_config_service_v2_get_sink_sync.py | 2 - ...ing_v2_config_service_v2_get_view_async.py | 2 - ...ging_v2_config_service_v2_get_view_sync.py | 2 - ...v2_config_service_v2_list_buckets_async.py | 2 - ..._v2_config_service_v2_list_buckets_sync.py | 2 - ...config_service_v2_list_exclusions_async.py | 2 - ..._config_service_v2_list_exclusions_sync.py | 2 - ...g_v2_config_service_v2_list_sinks_async.py | 2 - ...ng_v2_config_service_v2_list_sinks_sync.py | 2 - ...g_v2_config_service_v2_list_views_async.py | 2 - ...ng_v2_config_service_v2_list_views_sync.py | 2 - ...config_service_v2_undelete_bucket_async.py | 2 - ..._config_service_v2_undelete_bucket_sync.py | 2 - ...2_config_service_v2_update_bucket_async.py | 2 - ...v2_config_service_v2_update_bucket_sync.py | 2 - ...g_service_v2_update_cmek_settings_async.py | 2 - ...ig_service_v2_update_cmek_settings_sync.py | 2 - ...onfig_service_v2_update_exclusion_async.py | 2 - ...config_service_v2_update_exclusion_sync.py | 2 - ..._v2_config_service_v2_update_sink_async.py | 2 - ...g_v2_config_service_v2_update_sink_sync.py | 2 - ..._v2_config_service_v2_update_view_async.py | 2 - ...g_v2_config_service_v2_update_view_sync.py | 2 - ..._v2_logging_service_v2_delete_log_async.py | 2 - ...g_v2_logging_service_v2_delete_log_sync.py | 2 - ...gging_service_v2_list_log_entries_async.py | 2 - ...ogging_service_v2_list_log_entries_sync.py | 2 - ...g_v2_logging_service_v2_list_logs_async.py | 2 - ...ng_v2_logging_service_v2_list_logs_sync.py | 2 - ...st_monitored_resource_descriptors_async.py | 2 - ...ist_monitored_resource_descriptors_sync.py | 2 - ...gging_service_v2_tail_log_entries_async.py | 2 - ...ogging_service_v2_tail_log_entries_sync.py | 2 - ...ging_service_v2_write_log_entries_async.py | 2 - ...gging_service_v2_write_log_entries_sync.py | 2 - ...rics_service_v2_create_log_metric_async.py | 2 - ...trics_service_v2_create_log_metric_sync.py | 2 - ...rics_service_v2_delete_log_metric_async.py | 2 - ...trics_service_v2_delete_log_metric_sync.py | 2 - ...metrics_service_v2_get_log_metric_async.py | 2 - ..._metrics_service_v2_get_log_metric_sync.py | 2 - ...trics_service_v2_list_log_metrics_async.py | 2 - ...etrics_service_v2_list_log_metrics_sync.py | 2 - ...rics_service_v2_update_log_metric_async.py | 2 - ...trics_service_v2_update_log_metric_sync.py | 2 - .../snippet_metadata_logging_v2.json | 2966 +++++++++++++++++ .../services/cloud_redis/async_client.py | 241 ++ .../redis_v1/services/cloud_redis/client.py | 250 ++ ...is_v1_cloud_redis_create_instance_async.py | 2 - ...dis_v1_cloud_redis_create_instance_sync.py | 2 - ...is_v1_cloud_redis_delete_instance_async.py | 2 - ...dis_v1_cloud_redis_delete_instance_sync.py | 2 - ...is_v1_cloud_redis_export_instance_async.py | 2 - ...dis_v1_cloud_redis_export_instance_sync.py | 2 - ..._v1_cloud_redis_failover_instance_async.py | 2 - ...s_v1_cloud_redis_failover_instance_sync.py | 2 - ...redis_v1_cloud_redis_get_instance_async.py | 2 - ..._redis_v1_cloud_redis_get_instance_sync.py | 2 - ...is_v1_cloud_redis_import_instance_async.py | 2 - ...dis_v1_cloud_redis_import_instance_sync.py | 2 - ...dis_v1_cloud_redis_list_instances_async.py | 2 - ...edis_v1_cloud_redis_list_instances_sync.py | 2 - ...is_v1_cloud_redis_update_instance_async.py | 2 - ...dis_v1_cloud_redis_update_instance_sync.py | 2 - ...s_v1_cloud_redis_upgrade_instance_async.py | 2 - ...is_v1_cloud_redis_upgrade_instance_sync.py | 2 - .../snippet_metadata_redis_v1.json | 773 +++++ ...llusca_v1_snippets_list_resources_async.py | 2 - ...ollusca_v1_snippets_list_resources_sync.py | 2 - ...v1_snippets_method_bidi_streaming_async.py | 2 - ..._v1_snippets_method_bidi_streaming_sync.py | 2 - ...v1_snippets_method_lro_signatures_async.py | 2 - ..._v1_snippets_method_lro_signatures_sync.py | 2 - ..._v1_snippets_method_one_signature_async.py | 2 - ...a_v1_snippets_method_one_signature_sync.py | 2 - ..._snippets_method_server_streaming_async.py | 2 - ...1_snippets_method_server_streaming_sync.py | 2 - ...ollusca_v1_snippets_one_of_method_async.py | 2 - ...pets_one_of_method_required_field_async.py | 2 - ...ppets_one_of_method_required_field_sync.py | 2 - ...mollusca_v1_snippets_one_of_method_sync.py | 2 - .../snippet_metadata_v1_mollusca_v1.json | 611 ++++ tests/unit/__init__.py | 0 tests/unit/{samplegen => }/common_types.py | 0 tests/unit/generator/__init__.py | 0 tests/unit/generator/test_generator.py | 409 ++- tests/unit/samplegen/__init__.py | 0 .../samplegen/golden_snippets/sample_basic.py | 2 - .../golden_snippets/sample_basic_async.py | 2 - .../sample_basic_unflattenable.py | 2 - .../sample_basic_void_method.py | 2 - tests/unit/samplegen/test_integration.py | 53 +- tests/unit/samplegen/test_manifest.py | 2 +- tests/unit/samplegen/test_samplegen.py | 4 +- tests/unit/samplegen/test_snippet_index.py | 13 +- tests/unit/samplegen/test_template.py | 2 +- 170 files changed, 8943 insertions(+), 566 deletions(-) create mode 100644 tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_asset_v1.json create mode 100644 tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_credentials_v1.json create mode 100644 tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_logging_v2.json create mode 100644 tests/integration/goldens/redis/samples/generated_samples/snippet_metadata_redis_v1.json create mode 100644 tests/snippetgen/goldens/snippet_metadata_v1_mollusca_v1.json create mode 100644 tests/unit/__init__.py rename tests/unit/{samplegen => }/common_types.py (100%) create mode 100644 tests/unit/generator/__init__.py create mode 100644 tests/unit/samplegen/__init__.py diff --git a/gapic/generator/generator.py b/gapic/generator/generator.py index 7d2b2cc95c..609f70bb0f 100644 --- a/gapic/generator/generator.py +++ b/gapic/generator/generator.py @@ -17,12 +17,14 @@ import itertools import re import os +import pathlib import typing -from typing import Any, DefaultDict, Dict, Mapping +from typing import Any, DefaultDict, Dict, Mapping, Tuple from hashlib import sha256 from collections import OrderedDict, defaultdict from gapic.samplegen_utils.utils import coerce_response_name, is_valid_sample_cfg, render_format_string from gapic.samplegen_utils.types import DuplicateSample +from gapic.samplegen_utils import snippet_index, snippet_metadata_pb2 from gapic.samplegen import manifest, samplegen from gapic.generator import formatter from gapic.schema import api @@ -93,6 +95,17 @@ def get_response( self._env.loader.list_templates(), # type: ignore ) + # We generate code snippets *before* the library code so snippets + # can be inserted into method docstrings. + snippet_idx = snippet_index.SnippetIndex(api_schema) + if sample_templates: + sample_output, snippet_idx = self._generate_samples_and_manifest( + api_schema, snippet_idx, self._env.get_template( + sample_templates[0]), + opts=opts, + ) + output_files.update(sample_output) + # Iterate over each template and add the appropriate output files # based on that template. # Sample templates work differently: there's (usually) only one, @@ -107,15 +120,8 @@ def get_response( # Append to the output files dictionary. output_files.update( self._render_template( - template_name, api_schema=api_schema, opts=opts) - ) - - if sample_templates: - sample_output = self._generate_samples_and_manifest( - api_schema, self._env.get_template(sample_templates[0]), - opts=opts, + template_name, api_schema=api_schema, opts=opts, snippet_index=snippet_idx) ) - output_files.update(sample_output) # Return the CodeGeneratorResponse output. res = CodeGeneratorResponse( @@ -124,7 +130,7 @@ def get_response( return res def _generate_samples_and_manifest( - self, api_schema: api.API, sample_template: jinja2.Template, *, opts: Options) -> Dict: + self, api_schema: api.API, index: snippet_index.SnippetIndex, sample_template: jinja2.Template, *, opts: Options) -> Tuple[Dict, snippet_index.SnippetIndex]: """Generate samples and samplegen manifest for the API. Arguments: @@ -133,7 +139,7 @@ def _generate_samples_and_manifest( opts (Options): Additional generator options. Returns: - Dict[str, CodeGeneratorResponse.File]: A dict mapping filepath to rendered file. + Tuple[Dict[str, CodeGeneratorResponse.File], snippet_index.SnippetIndex] : A dict mapping filepath to rendered file. """ # The two-layer data structure lets us do two things: # * detect duplicate samples, which is an error @@ -181,7 +187,7 @@ def _generate_samples_and_manifest( if not id_is_unique: spec["id"] += f"_{spec_hash}" - sample = samplegen.generate_sample( + sample, snippet_metadata = samplegen.generate_sample( spec, api_schema, sample_template,) fpath = utils.to_snake_case(spec["id"]) + ".py" @@ -190,6 +196,11 @@ def _generate_samples_and_manifest( sample, ) + snippet_metadata.file = fpath + + index.add_snippet( + snippet_index.Snippet(sample, snippet_metadata)) + output_files = { fname: CodeGeneratorResponse.File( content=formatter.fix_whitespace(sample), name=fname @@ -197,29 +208,18 @@ def _generate_samples_and_manifest( for fname, (_, sample) in fpath_to_spec_and_rendered.items() } - # TODO(busunkim): Re-enable manifest generation once metadata - # format has been formalized. - # https://docs.google.com/document/d/1ghBam8vMj3xdoe4xfXhzVcOAIwrkbTpkMLgKc9RPD9k/edit#heading=h.sakzausv6hue - # - # if output_files: - - # manifest_fname, manifest_doc = manifest.generate( - # ( - # (fname, spec) - # for fname, (spec, _) in fpath_to_spec_and_rendered.items() - # ), - # api_schema, - # ) - - # manifest_fname = os.path.join(out_dir, manifest_fname) - # output_files[manifest_fname] = CodeGeneratorResponse.File( - # content=manifest_doc.render(), name=manifest_fname - # ) + if index.metadata_index.snippets: + # NOTE(busunkim): Not all fields are yet populated in the snippet metadata. + # Expected filename: snippet_metadata_{apishortname}_{apiversion}.json + snippet_metadata_path = str(pathlib.Path( + out_dir) / f"snippet_metadata_{api_schema.naming.name}_{api_schema.naming.version}.json").lower() + output_files[snippet_metadata_path] = CodeGeneratorResponse.File( + content=formatter.fix_whitespace(index.get_metadata_json()), name=snippet_metadata_path) - return output_files + return output_files, index def _render_template( - self, template_name: str, *, api_schema: api.API, opts: Options, + self, template_name: str, *, api_schema: api.API, opts: Options, snippet_index: snippet_index.SnippetIndex, ) -> Dict[str, CodeGeneratorResponse.File]: """Render the requested templates. @@ -258,7 +258,7 @@ def _render_template( for subpackage in api_schema.subpackages.values(): answer.update( self._render_template( - template_name, api_schema=subpackage, opts=opts + template_name, api_schema=subpackage, opts=opts, snippet_index=snippet_index ) ) skip_subpackages = True @@ -275,7 +275,7 @@ def _render_template( answer.update( self._get_file( - template_name, api_schema=api_schema, proto=proto, opts=opts + template_name, api_schema=api_schema, proto=proto, opts=opts, snippet_index=snippet_index ) ) @@ -304,6 +304,7 @@ def _render_template( api_schema=api_schema, service=service, opts=opts, + snippet_index=snippet_index, ) ) return answer @@ -311,7 +312,7 @@ def _render_template( # This file is not iterating over anything else; return back # the one applicable file. answer.update(self._get_file( - template_name, api_schema=api_schema, opts=opts)) + template_name, api_schema=api_schema, opts=opts, snippet_index=snippet_index)) return answer def _is_desired_transport(self, template_name: str, opts: Options) -> bool: @@ -324,8 +325,8 @@ def _get_file( template_name: str, *, opts: Options, - api_schema=api.API, - **context: Mapping, + api_schema: api.API, + **context, ): """Render a template to a protobuf plugin File object.""" # Determine the target filename. diff --git a/gapic/samplegen/samplegen.py b/gapic/samplegen/samplegen.py index 35667f5af6..7f4c3dae31 100644 --- a/gapic/samplegen/samplegen.py +++ b/gapic/samplegen/samplegen.py @@ -24,13 +24,13 @@ from gapic import utils -from gapic.samplegen_utils import types +from gapic.samplegen_utils import types, snippet_metadata_pb2 # type: ignore from gapic.samplegen_utils.utils import is_valid_sample_cfg from gapic.schema import api from gapic.schema import wrappers from collections import defaultdict, namedtuple, ChainMap as chainmap -from typing import Any, ChainMap, Dict, FrozenSet, Generator, List, Mapping, Optional, Sequence +from typing import Any, ChainMap, Dict, FrozenSet, Generator, List, Mapping, Optional, Sequence, Tuple # There is no library stub file for this module, so ignore it. from google.api import resource_pb2 # type: ignore @@ -915,8 +915,6 @@ def _validate_loop(self, loop): def parse_handwritten_specs(sample_configs: Sequence[str]) -> Generator[Dict[str, Any], None, None]: """Parse a handwritten sample spec""" - STANDALONE_TYPE = "standalone" - for config_fpath in sample_configs: with open(config_fpath) as f: configs = yaml.safe_load_all(f.read()) @@ -925,13 +923,9 @@ def parse_handwritten_specs(sample_configs: Sequence[str]) -> Generator[Dict[str valid = is_valid_sample_cfg(cfg) if not valid: raise types.InvalidConfig( - "Sample config is invalid", valid) + "Sample config in '{}' is invalid\n\n{}".format(config_fpath, cfg), valid) for spec in cfg.get("samples", []): - # If unspecified, assume a sample config describes a standalone. - # If sample_types are specified, standalone samples must be - # explicitly enabled. - if STANDALONE_TYPE in spec.get("sample_type", [STANDALONE_TYPE]): - yield spec + yield spec def _generate_resource_path_request_object(field_name: str, message: wrappers.MessageType) -> List[Dict[str, str]]: @@ -1050,7 +1044,6 @@ def generate_sample_specs(api_schema: api.API, *, opts) -> Generator[Dict[str, A # [{START|END} ${apishortname}_generated_${api}_${apiVersion}_${serviceName}_${rpcName}_{sync|async}_${overloadDisambiguation}] region_tag = f"{api_short_name}_generated_{api_schema.naming.versioned_module_name}_{service_name}_{rpc_name}_{transport_type}" spec = { - "sample_type": "standalone", "rpc": rpc_name, "transport": transport, # `request` and `response` is populated in `preprocess_sample` @@ -1062,7 +1055,7 @@ def generate_sample_specs(api_schema: api.API, *, opts) -> Generator[Dict[str, A yield spec -def generate_sample(sample, api_schema, sample_template: jinja2.Template) -> str: +def generate_sample(sample, api_schema, sample_template: jinja2.Template) -> Tuple[str, Any]: """Generate a standalone, runnable sample. Writing the rendered output is left for the caller. @@ -1073,7 +1066,7 @@ def generate_sample(sample, api_schema, sample_template: jinja2.Template) -> str sample_template (jinja2.Template): The template representing a generic sample. Returns: - str: The rendered sample. + Tuple(str, snippet_metadata_pb2.Snippet): The rendered sample. """ service_name = sample["service"] service = api_schema.services.get(service_name) @@ -1100,6 +1093,17 @@ def generate_sample(sample, api_schema, sample_template: jinja2.Template) -> str v.validate_response(sample["response"]) + # Snippet Metadata can't be fully filled out in any one function + # In this function we add information from + # the API schema and sample dictionary. + snippet_metadata = snippet_metadata_pb2.Snippet() # type: ignore + snippet_metadata.region_tag = sample["region_tag"] + setattr(snippet_metadata.client_method, "async", + sample["transport"] == api.TRANSPORT_GRPC_ASYNC) + snippet_metadata.client_method.method.short_name = sample["rpc"] + snippet_metadata.client_method.method.service.short_name = sample["service"].split( + ".")[-1] + return sample_template.render( sample=sample, imports=[], @@ -1107,4 +1111,4 @@ def generate_sample(sample, api_schema, sample_template: jinja2.Template) -> str calling_form_enum=types.CallingForm, trim_blocks=True, lstrip_blocks=True, - ) + ), snippet_metadata diff --git a/gapic/samplegen_utils/snippet_index.py b/gapic/samplegen_utils/snippet_index.py index a8594a92ee..8b7d3d0794 100644 --- a/gapic/samplegen_utils/snippet_index.py +++ b/gapic/samplegen_utils/snippet_index.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Dict import re +from typing import Optional, Dict from google.protobuf import json_format @@ -88,6 +88,7 @@ def full_snippet(self) -> str: """The portion between the START and END region tags.""" start_idx = self._full_snippet.start - 1 end_idx = self._full_snippet.end + self.sample_lines[start_idx] = self.sample_lines[start_idx].strip() return "".join(self.sample_lines[start_idx:end_idx]) @@ -124,7 +125,7 @@ def add_snippet(self, snippet: Snippet) -> None: RpcMethodNotFound: If the method indicated by the snippet metadata is not found. """ service_name = snippet.metadata.client_method.method.service.short_name - rpc_name = snippet.metadata.client_method.method.full_name + rpc_name = snippet.metadata.client_method.method.short_name service = self._index.get(service_name) if service is None: @@ -172,4 +173,8 @@ def get_snippet(self, service_name: str, rpc_name: str, sync: bool = True) -> Op def get_metadata_json(self) -> str: """JSON representation of Snippet Index.""" + + # Downstream tools assume the generator will produce the exact + # same output when run over the same API multiple times + self.metadata_index.snippets.sort(key=lambda s: s.region_tag) return json_format.MessageToJson(self.metadata_index, sort_keys=True) diff --git a/gapic/schema/wrappers.py b/gapic/schema/wrappers.py index 67fa3afe23..cb9203bb78 100644 --- a/gapic/schema/wrappers.py +++ b/gapic/schema/wrappers.py @@ -41,7 +41,7 @@ from google.api import resource_pb2 from google.api_core import exceptions from google.api_core import path_template -from google.cloud import extended_operations_pb2 as ex_ops_pb2 +from google.cloud import extended_operations_pb2 as ex_ops_pb2 # type: ignore from google.protobuf import descriptor_pb2 # type: ignore from google.protobuf.json_format import MessageToDict # type: ignore diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index b4173b2469..4e22e94625 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -207,6 +207,14 @@ class {{ service.async_client_name }}: {% endif %} r"""{{ method.meta.doc|rst(width=72, indent=8) }} + {% with snippet = snippet_index.get_snippet(service.name, method.name, sync=True) %} + {% if snippet is not none %} + .. code-block:: + +{{ snippet.full_snippet|indent(width=12, first=True) }} + {% endif %} + {% endwith %} + Args: {% if not method.client_streaming %} request (Union[{{ method.input.ident.sphinx }}, dict]): diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 index c47ac6f465..451ac1afb2 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 @@ -363,6 +363,15 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): {% endif %} r"""{{ method.meta.doc|rst(width=72, indent=8) }} + + {% with snippet = snippet_index.get_snippet(service.name, method.name, sync=True) %} + {% if snippet is not none %} + .. code-block:: + +{{ snippet.full_snippet|indent(width=12, first=True) }} + {% endif %} + {% endwith %} + Args: {% if not method.client_streaming %} request (Union[{{ method.input.ident.sphinx }}, dict]): diff --git a/gapic/templates/examples/sample.py.j2 b/gapic/templates/examples/sample.py.j2 index 3191860c0c..a754765804 100644 --- a/gapic/templates/examples/sample.py.j2 +++ b/gapic/templates/examples/sample.py.j2 @@ -32,8 +32,6 @@ from {{ sample.module_namespace|join(".") }} import {{ sample.module_name }} {# also need calling form #} {% 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, calling_form, calling_form_enum)|indent }} {% with method_call = frags.render_method_call(sample, calling_form, calling_form_enum, sample.transport) %} diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py index e4c02ed392..55c4ae53c3 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py @@ -210,6 +210,32 @@ async def export_assets(self, the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_export_assets(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + output_config = asset_v1.OutputConfig() + output_config.gcs_destination.uri = "uri_value" + + request = asset_v1.ExportAssetsRequest( + parent="parent_value", + output_config=output_config, + ) + + # Make the request + operation = client.export_assets(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.asset_v1.types.ExportAssetsRequest, dict]): The request object. Export asset request. @@ -279,6 +305,25 @@ async def list_assets(self, r"""Lists assets with time and resource types and returns paged results in response. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_list_assets(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.ListAssetsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_assets(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.asset_v1.types.ListAssetsRequest, dict]): The request object. ListAssets request. @@ -372,6 +417,26 @@ async def batch_get_assets_history(self, specified asset does not exist, this API returns an INVALID_ARGUMENT error. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_batch_get_assets_history(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.BatchGetAssetsHistoryRequest( + parent="parent_value", + ) + + # Make the request + response = client.batch_get_assets_history(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.BatchGetAssetsHistoryRequest, dict]): The request object. Batch get assets history request. @@ -434,6 +499,31 @@ async def create_feed(self, project/folder/organization to listen to its asset updates. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_create_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + feed = asset_v1.Feed() + feed.name = "name_value" + + request = asset_v1.CreateFeedRequest( + parent="parent_value", + feed_id="feed_id_value", + feed=feed, + ) + + # Make the request + response = client.create_feed(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.CreateFeedRequest, dict]): The request object. Create asset feed request. @@ -520,6 +610,29 @@ async def get_feed(self, ) -> asset_service.Feed: r"""Gets details about an asset feed. + .. code-block:: + + from google.cloud import asset_v1 + + def sample_get_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + feed = "feed_value" + name = f"projects/{project}/feeds/{feed}" + + request = asset_v1.GetFeedRequest( + name=name, + ) + + # Make the request + response = client.get_feed(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.GetFeedRequest, dict]): The request object. Get asset feed request. @@ -609,6 +722,26 @@ async def list_feeds(self, r"""Lists all asset feeds in a parent project/folder/organization. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_list_feeds(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.ListFeedsRequest( + parent="parent_value", + ) + + # Make the request + response = client.list_feeds(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.ListFeedsRequest, dict]): The request object. List asset feeds request. @@ -692,6 +825,28 @@ async def update_feed(self, ) -> asset_service.Feed: r"""Updates an asset feed configuration. + .. code-block:: + + from google.cloud import asset_v1 + + def sample_update_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + feed = asset_v1.Feed() + feed.name = "name_value" + + request = asset_v1.UpdateFeedRequest( + feed=feed, + ) + + # Make the request + response = client.update_feed(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.UpdateFeedRequest, dict]): The request object. Update asset feed request. @@ -774,6 +929,26 @@ async def delete_feed(self, ) -> None: r"""Deletes an asset feed. + .. code-block:: + + from google.cloud import asset_v1 + + def sample_delete_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + feed = "feed_value" + name = f"projects/{project}/feeds/{feed}" + + request = asset_v1.DeleteFeedRequest( + name=name, + ) + + # Make the request + response = client.delete_feed(request=request) + Args: request (Union[google.cloud.asset_v1.types.DeleteFeedRequest, dict]): The request object. @@ -853,6 +1028,25 @@ async def search_all_resources(self, the ``cloudasset.assets.searchAllResources`` permission on the desired scope, otherwise the request will be rejected. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_search_all_resources(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.SearchAllResourcesRequest( + scope="scope_value", + ) + + # Make the request + page_result = client.search_all_resources(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.asset_v1.types.SearchAllResourcesRequest, dict]): The request object. Search all resources request. @@ -1039,6 +1233,25 @@ async def search_all_iam_policies(self, ``cloudasset.assets.searchAllIamPolicies`` permission on the desired scope, otherwise the request will be rejected. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_search_all_iam_policies(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.SearchAllIamPoliciesRequest( + scope="scope_value", + ) + + # Make the request + page_result = client.search_all_iam_policies(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.asset_v1.types.SearchAllIamPoliciesRequest, dict]): The request object. Search all IAM policies request. @@ -1201,6 +1414,29 @@ async def analyze_iam_policy(self, r"""Analyzes IAM policies to answer which identities have what accesses on which resources. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_analyze_iam_policy(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + analysis_query = asset_v1.IamPolicyAnalysisQuery() + analysis_query.scope = "scope_value" + + request = asset_v1.AnalyzeIamPolicyRequest( + analysis_query=analysis_query, + ) + + # Make the request + response = client.analyze_iam_policy(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyRequest, dict]): The request object. A request message for @@ -1273,6 +1509,35 @@ async def analyze_iam_policy_longrunning(self, to poll the operation result. The metadata contains the request to help callers to map responses to requests. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_analyze_iam_policy_longrunning(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + analysis_query = asset_v1.IamPolicyAnalysisQuery() + analysis_query.scope = "scope_value" + + output_config = asset_v1.IamPolicyAnalysisOutputConfig() + output_config.gcs_destination.uri = "uri_value" + + request = asset_v1.AnalyzeIamPolicyLongrunningRequest( + analysis_query=analysis_query, + output_config=output_config, + ) + + # Make the request + operation = client.analyze_iam_policy_longrunning(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyLongrunningRequest, dict]): The request object. A request message for diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py index 3d1da34da7..5ddda9d5fa 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py @@ -397,6 +397,33 @@ def export_assets(self, the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_export_assets(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + output_config = asset_v1.OutputConfig() + output_config.gcs_destination.uri = "uri_value" + + request = asset_v1.ExportAssetsRequest( + parent="parent_value", + output_config=output_config, + ) + + # Make the request + operation = client.export_assets(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.asset_v1.types.ExportAssetsRequest, dict]): The request object. Export asset request. @@ -467,6 +494,26 @@ def list_assets(self, r"""Lists assets with time and resource types and returns paged results in response. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_list_assets(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.ListAssetsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_assets(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.asset_v1.types.ListAssetsRequest, dict]): The request object. ListAssets request. @@ -560,6 +607,27 @@ def batch_get_assets_history(self, specified asset does not exist, this API returns an INVALID_ARGUMENT error. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_batch_get_assets_history(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.BatchGetAssetsHistoryRequest( + parent="parent_value", + ) + + # Make the request + response = client.batch_get_assets_history(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.BatchGetAssetsHistoryRequest, dict]): The request object. Batch get assets history request. @@ -616,6 +684,32 @@ def create_feed(self, project/folder/organization to listen to its asset updates. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_create_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + feed = asset_v1.Feed() + feed.name = "name_value" + + request = asset_v1.CreateFeedRequest( + parent="parent_value", + feed_id="feed_id_value", + feed=feed, + ) + + # Make the request + response = client.create_feed(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.CreateFeedRequest, dict]): The request object. Create asset feed request. @@ -702,6 +796,30 @@ def get_feed(self, ) -> asset_service.Feed: r"""Gets details about an asset feed. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_get_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + feed = "feed_value" + name = f"projects/{project}/feeds/{feed}" + + request = asset_v1.GetFeedRequest( + name=name, + ) + + # Make the request + response = client.get_feed(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.GetFeedRequest, dict]): The request object. Get asset feed request. @@ -784,6 +902,27 @@ def list_feeds(self, r"""Lists all asset feeds in a parent project/folder/organization. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_list_feeds(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.ListFeedsRequest( + parent="parent_value", + ) + + # Make the request + response = client.list_feeds(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.ListFeedsRequest, dict]): The request object. List asset feeds request. @@ -860,6 +999,29 @@ def update_feed(self, ) -> asset_service.Feed: r"""Updates an asset feed configuration. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_update_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + feed = asset_v1.Feed() + feed.name = "name_value" + + request = asset_v1.UpdateFeedRequest( + feed=feed, + ) + + # Make the request + response = client.update_feed(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.UpdateFeedRequest, dict]): The request object. Update asset feed request. @@ -942,6 +1104,27 @@ def delete_feed(self, ) -> None: r"""Deletes an asset feed. + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_delete_feed(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + feed = "feed_value" + name = f"projects/{project}/feeds/{feed}" + + request = asset_v1.DeleteFeedRequest( + name=name, + ) + + # Make the request + response = client.delete_feed(request=request) + Args: request (Union[google.cloud.asset_v1.types.DeleteFeedRequest, dict]): The request object. @@ -1014,6 +1197,26 @@ def search_all_resources(self, the ``cloudasset.assets.searchAllResources`` permission on the desired scope, otherwise the request will be rejected. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_search_all_resources(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.SearchAllResourcesRequest( + scope="scope_value", + ) + + # Make the request + page_result = client.search_all_resources(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.asset_v1.types.SearchAllResourcesRequest, dict]): The request object. Search all resources request. @@ -1193,6 +1396,26 @@ def search_all_iam_policies(self, ``cloudasset.assets.searchAllIamPolicies`` permission on the desired scope, otherwise the request will be rejected. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_search_all_iam_policies(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + request = asset_v1.SearchAllIamPoliciesRequest( + scope="scope_value", + ) + + # Make the request + page_result = client.search_all_iam_policies(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.asset_v1.types.SearchAllIamPoliciesRequest, dict]): The request object. Search all IAM policies request. @@ -1348,6 +1571,30 @@ def analyze_iam_policy(self, r"""Analyzes IAM policies to answer which identities have what accesses on which resources. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_analyze_iam_policy(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + analysis_query = asset_v1.IamPolicyAnalysisQuery() + analysis_query.scope = "scope_value" + + request = asset_v1.AnalyzeIamPolicyRequest( + analysis_query=analysis_query, + ) + + # Make the request + response = client.analyze_iam_policy(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyRequest, dict]): The request object. A request message for @@ -1415,6 +1662,36 @@ def analyze_iam_policy_longrunning(self, to poll the operation result. The metadata contains the request to help callers to map responses to requests. + + + .. code-block:: + + from google.cloud import asset_v1 + + def sample_analyze_iam_policy_longrunning(): + # Create a client + client = asset_v1.AssetServiceClient() + + # Initialize request argument(s) + analysis_query = asset_v1.IamPolicyAnalysisQuery() + analysis_query.scope = "scope_value" + + output_config = asset_v1.IamPolicyAnalysisOutputConfig() + output_config.gcs_destination.uri = "uri_value" + + request = asset_v1.AnalyzeIamPolicyLongrunningRequest( + analysis_query=analysis_query, + output_config=output_config, + ) + + # Make the request + operation = client.analyze_iam_policy_longrunning(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyLongrunningRequest, dict]): The request object. A request message for 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 index 8147347e66..1759b7e38c 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_analyze_iam_policy(): - """Snippet for analyze_iam_policy""" - # Create a client client = asset_v1.AssetServiceAsyncClient() 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 index 12e57510e8..51ef3ab86a 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_analyze_iam_policy_longrunning(): - """Snippet for analyze_iam_policy_longrunning""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py index a4e998a182..eee8fb97ed 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py @@ -28,8 +28,6 @@ def sample_analyze_iam_policy_longrunning(): - """Snippet for analyze_iam_policy_longrunning""" - # Create a client client = asset_v1.AssetServiceClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py index 1a02995511..9dd1895509 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py @@ -28,8 +28,6 @@ def sample_analyze_iam_policy(): - """Snippet for analyze_iam_policy""" - # Create a client client = asset_v1.AssetServiceClient() 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 index bdc83d37df..edae4c7f92 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_batch_get_assets_history(): - """Snippet for batch_get_assets_history""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py index 5a4b1abbaa..5bf8c8de15 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py @@ -28,8 +28,6 @@ def sample_batch_get_assets_history(): - """Snippet for batch_get_assets_history""" - # Create a client client = asset_v1.AssetServiceClient() 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 index d0b4a37a3a..a988dfe5d4 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_create_feed(): - """Snippet for create_feed""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_sync.py index 9eb643290b..e330288229 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_create_feed_sync.py @@ -28,8 +28,6 @@ def sample_create_feed(): - """Snippet for create_feed""" - # Create a client client = asset_v1.AssetServiceClient() 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 index d4df7397d4..4439eee886 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_feed(): - """Snippet for delete_feed""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py index a49c063140..ac34a49c01 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py @@ -28,8 +28,6 @@ def sample_delete_feed(): - """Snippet for delete_feed""" - # Create a client client = asset_v1.AssetServiceClient() 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 index 4edfb7ae3f..f384bea0ad 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_export_assets(): - """Snippet for export_assets""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_sync.py index 62fcbbfff7..4ac84ea713 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_export_assets_sync.py @@ -28,8 +28,6 @@ def sample_export_assets(): - """Snippet for export_assets""" - # Create a client client = asset_v1.AssetServiceClient() 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 index bd91353f3c..29cd0a2b16 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_feed(): - """Snippet for get_feed""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_sync.py index 493ff224ab..30849fccb7 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_get_feed_sync.py @@ -28,8 +28,6 @@ def sample_get_feed(): - """Snippet for get_feed""" - # Create a client client = asset_v1.AssetServiceClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_async.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_async.py index e21b4e35c3..0a6a0b4a09 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_async.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_async.py @@ -28,8 +28,6 @@ async def sample_list_assets(): - """Snippet for list_assets""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_sync.py index ef1dd925c0..5fad10b12a 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_assets_sync.py @@ -28,8 +28,6 @@ def sample_list_assets(): - """Snippet for list_assets""" - # Create a client client = asset_v1.AssetServiceClient() 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 index 31a26bde20..8eec6bfab4 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_feeds(): - """Snippet for list_feeds""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py index 9075f2cd9f..7aba515f8b 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py @@ -28,8 +28,6 @@ def sample_list_feeds(): - """Snippet for list_feeds""" - # Create a client client = asset_v1.AssetServiceClient() 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 index 3893b85552..9be060836a 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_search_all_iam_policies(): - """Snippet for search_all_iam_policies""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py index 53133196b1..e39c08295b 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py @@ -28,8 +28,6 @@ def sample_search_all_iam_policies(): - """Snippet for search_all_iam_policies""" - # Create a client client = asset_v1.AssetServiceClient() 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 index d97f46fb4f..aba043b4b8 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_search_all_resources(): - """Snippet for search_all_resources""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py index 30f66f6ef4..475d8b4ad5 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py @@ -28,8 +28,6 @@ def sample_search_all_resources(): - """Snippet for search_all_resources""" - # Create a client client = asset_v1.AssetServiceClient() 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 index 6cebe148df..e409b05b71 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_feed(): - """Snippet for update_feed""" - # Create a client client = asset_v1.AssetServiceAsyncClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_sync.py b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_sync.py index d2046c2d9b..214f4886f2 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_sync.py +++ b/tests/integration/goldens/asset/samples/generated_samples/cloudasset_generated_asset_v1_asset_service_update_feed_sync.py @@ -28,8 +28,6 @@ def sample_update_feed(): - """Snippet for update_feed""" - # Create a client client = asset_v1.AssetServiceClient() diff --git a/tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_asset_v1.json b/tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_asset_v1.json new file mode 100644 index 0000000000..8f871de592 --- /dev/null +++ b/tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_asset_v1.json @@ -0,0 +1,1048 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "AnalyzeIamPolicyLongrunning" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "AnalyzeIamPolicyLongrunning" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_longrunning_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicyLongrunning_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "AnalyzeIamPolicy" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "AnalyzeIamPolicy" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_analyze_iam_policy_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_AnalyzeIamPolicy_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "BatchGetAssetsHistory" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "BatchGetAssetsHistory" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_batch_get_assets_history_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_BatchGetAssetsHistory_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "CreateFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_create_feed_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_CreateFeed_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "CreateFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_create_feed_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_CreateFeed_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "DeleteFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_delete_feed_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_DeleteFeed_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "DeleteFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_delete_feed_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_DeleteFeed_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "ExportAssets" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_export_assets_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_ExportAssets_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "ExportAssets" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_export_assets_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_ExportAssets_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "GetFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_get_feed_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_GetFeed_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "GetFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_get_feed_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_GetFeed_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "ListAssets" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_list_assets_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_ListAssets_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "ListAssets" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_list_assets_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_ListAssets_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "ListFeeds" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_list_feeds_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_ListFeeds_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "ListFeeds" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_list_feeds_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_ListFeeds_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "SearchAllIamPolicies" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "SearchAllIamPolicies" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_search_all_iam_policies_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_SearchAllIamPolicies_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "SearchAllResources" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_search_all_resources_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_SearchAllResources_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "SearchAllResources" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_search_all_resources_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_SearchAllResources_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "UpdateFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_update_feed_async.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_UpdateFeed_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AssetService" + }, + "shortName": "UpdateFeed" + } + }, + "file": "cloudasset_generated_asset_v1_asset_service_update_feed_sync.py", + "regionTag": "cloudasset_generated_asset_v1_AssetService_UpdateFeed_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py index 1863e3521d..cd7019d14e 100644 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py @@ -208,6 +208,31 @@ async def generate_access_token(self, r"""Generates an OAuth 2.0 access token for a service account. + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_generate_access_token(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.GenerateAccessTokenRequest( + name=name, + scope=['scope_value_1', 'scope_value_2'], + ) + + # Make the request + response = client.generate_access_token(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.GenerateAccessTokenRequest, dict]): The request object. @@ -341,6 +366,31 @@ async def generate_id_token(self, r"""Generates an OpenID Connect ID token for a service account. + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_generate_id_token(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.GenerateIdTokenRequest( + name=name, + audience="audience_value", + ) + + # Make the request + response = client.generate_id_token(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.GenerateIdTokenRequest, dict]): The request object. @@ -467,6 +517,31 @@ async def sign_blob(self, r"""Signs a blob using a service account's system-managed private key. + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_sign_blob(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.SignBlobRequest( + name=name, + payload=b'payload_blob', + ) + + # Make the request + response = client.sign_blob(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.SignBlobRequest, dict]): The request object. @@ -580,6 +655,31 @@ async def sign_jwt(self, r"""Signs a JWT using a service account's system-managed private key. + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_sign_jwt(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.SignJwtRequest( + name=name, + payload="payload_value", + ) + + # Make the request + response = client.sign_jwt(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.SignJwtRequest, dict]): The request object. diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py index 3a856a9eed..93876b0369 100644 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py @@ -386,6 +386,32 @@ def generate_access_token(self, r"""Generates an OAuth 2.0 access token for a service account. + + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_generate_access_token(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.GenerateAccessTokenRequest( + name=name, + scope=['scope_value_1', 'scope_value_2'], + ) + + # Make the request + response = client.generate_access_token(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.GenerateAccessTokenRequest, dict]): The request object. @@ -512,6 +538,32 @@ def generate_id_token(self, r"""Generates an OpenID Connect ID token for a service account. + + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_generate_id_token(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.GenerateIdTokenRequest( + name=name, + audience="audience_value", + ) + + # Make the request + response = client.generate_id_token(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.GenerateIdTokenRequest, dict]): The request object. @@ -631,6 +683,32 @@ def sign_blob(self, r"""Signs a blob using a service account's system-managed private key. + + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_sign_blob(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.SignBlobRequest( + name=name, + payload=b'payload_blob', + ) + + # Make the request + response = client.sign_blob(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.SignBlobRequest, dict]): The request object. @@ -737,6 +815,32 @@ def sign_jwt(self, r"""Signs a JWT using a service account's system-managed private key. + + + .. code-block:: + + from google.iam import credentials_v1 + + def sample_sign_jwt(): + # Create a client + client = credentials_v1.IAMCredentialsClient() + + # Initialize request argument(s) + project = "my-project-id" + service_account = "service_account_value" + name = f"projects/{project}/serviceAccounts/{service_account}" + + request = credentials_v1.SignJwtRequest( + name=name, + payload="payload_value", + ) + + # Make the request + response = client.sign_jwt(request=request) + + # Handle response + print(response) + Args: request (Union[google.iam.credentials_v1.types.SignJwtRequest, dict]): The request object. 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 index 55a66bc125..650f82bdba 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_generate_access_token(): - """Snippet for generate_access_token""" - # Create a client client = credentials_v1.IAMCredentialsAsyncClient() diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py index 9487ea9725..17fedfa26a 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py @@ -28,8 +28,6 @@ def sample_generate_access_token(): - """Snippet for generate_access_token""" - # Create a client client = credentials_v1.IAMCredentialsClient() 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 index 03dee14637..00d6538ca9 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_generate_id_token(): - """Snippet for generate_id_token""" - # Create a client client = credentials_v1.IAMCredentialsAsyncClient() diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py index fd901f81fc..71e49cef58 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py @@ -28,8 +28,6 @@ def sample_generate_id_token(): - """Snippet for generate_id_token""" - # Create a client client = credentials_v1.IAMCredentialsClient() 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 index 5929291181..b39981bbdd 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_sign_blob(): - """Snippet for sign_blob""" - # Create a client client = credentials_v1.IAMCredentialsAsyncClient() diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py index d54b6a5e61..fbc18e178d 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py @@ -28,8 +28,6 @@ def sample_sign_blob(): - """Snippet for sign_blob""" - # Create a client client = credentials_v1.IAMCredentialsClient() 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 index bb72d42269..35e8655785 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_sign_jwt(): - """Snippet for sign_jwt""" - # Create a client client = credentials_v1.IAMCredentialsAsyncClient() diff --git a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py index 6c05080885..298bfaf3e0 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py +++ b/tests/integration/goldens/credentials/samples/generated_samples/iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py @@ -28,8 +28,6 @@ def sample_sign_jwt(): - """Snippet for sign_jwt""" - # Create a client client = credentials_v1.IAMCredentialsClient() diff --git a/tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_credentials_v1.json b/tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_credentials_v1.json new file mode 100644 index 0000000000..8217a23d26 --- /dev/null +++ b/tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_credentials_v1.json @@ -0,0 +1,360 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "GenerateAccessToken" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_async.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "GenerateAccessToken" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_generate_access_token_sync.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_GenerateAccessToken_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "GenerateIdToken" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_async.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "GenerateIdToken" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_generate_id_token_sync.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_GenerateIdToken_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "SignBlob" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_async.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "SignBlob" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_sign_blob_sync.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_SignBlob_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "SignJwt" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_async.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "IAMCredentials" + }, + "shortName": "SignJwt" + } + }, + "file": "iamcredentials_generated_credentials_v1_iam_credentials_sign_jwt_sync.py", + "regionTag": "iamcredentials_generated_credentials_v1_IAMCredentials_SignJwt_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py index 584f512404..01dd8b6300 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py @@ -203,6 +203,29 @@ async def list_buckets(self, ) -> pagers.ListBucketsAsyncPager: r"""Lists buckets. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_buckets(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + parent = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.ListBucketsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_buckets(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]): The request object. The parameters to `ListBuckets`. @@ -298,6 +321,30 @@ async def get_bucket(self, ) -> logging_config.LogBucket: r"""Gets a bucket. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.GetBucketRequest( + name=name, + ) + + # Make the request + response = client.get_bucket(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetBucketRequest, dict]): The request object. The parameters to `GetBucket`. @@ -352,6 +399,32 @@ async def create_bucket(self, entries. Once a bucket has been created, the region cannot be changed. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + parent = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.CreateBucketRequest( + parent=parent, + bucket_id="bucket_id_value", + ) + + # Make the request + response = client.create_bucket(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]): The request object. The parameters to `CreateBucket`. @@ -414,6 +487,31 @@ async def update_bucket(self, A buckets region may not be modified after it is created. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.UpdateBucketRequest( + name=name, + ) + + # Make the request + response = client.update_bucket(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]): The request object. The parameters to `UpdateBucket`. @@ -468,6 +566,28 @@ async def delete_bucket(self, state. After 7 days, the bucket will be purged and all logs in the bucket will be permanently deleted. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.DeleteBucketRequest( + name=name, + ) + + # Make the request + response = client.delete_bucket(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]): The request object. The parameters to `DeleteBucket`. @@ -514,6 +634,28 @@ async def undelete_bucket(self, r"""Undeletes a bucket. A bucket that has been deleted may be undeleted within the grace period of 7 days. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_undelete_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.UndeleteBucketRequest( + name=name, + ) + + # Make the request + response = client.undelete_bucket(request=request) + Args: request (Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]): The request object. The parameters to `UndeleteBucket`. @@ -560,6 +702,24 @@ async def list_views(self, ) -> pagers.ListViewsAsyncPager: r"""Lists views on a bucket. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_views(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListViewsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_views(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListViewsRequest, dict]): The request object. The parameters to `ListViews`. @@ -647,6 +807,31 @@ async def get_view(self, ) -> logging_config.LogView: r"""Gets a view. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + view = "view_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" + + request = logging_v2.GetViewRequest( + name=name, + ) + + # Make the request + response = client.get_view(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetViewRequest, dict]): The request object. The parameters to `GetView`. @@ -702,6 +887,27 @@ async def create_view(self, r"""Creates a view over logs in a bucket. A bucket may contain a maximum of 50 views. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.CreateViewRequest( + parent="parent_value", + view_id="view_id_value", + ) + + # Make the request + response = client.create_view(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateViewRequest, dict]): The request object. The parameters to `CreateView`. @@ -757,6 +963,26 @@ async def update_view(self, r"""Updates a view. This method replaces the following fields in the existing view with values from the new view: ``filter``. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.UpdateViewRequest( + name="name_value", + ) + + # Make the request + response = client.update_view(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]): The request object. The parameters to `UpdateView`. @@ -811,6 +1037,28 @@ async def delete_view(self, ) -> None: r"""Deletes a view from a bucket. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + view = "view_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" + + request = logging_v2.DeleteViewRequest( + name=name, + ) + + # Make the request + response = client.delete_view(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]): The request object. The parameters to `DeleteView`. @@ -857,6 +1105,28 @@ async def list_sinks(self, ) -> pagers.ListSinksAsyncPager: r"""Lists sinks. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_sinks(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + parent = f"projects/{project}/sinks/{sink}" + + request = logging_v2.ListSinksRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_sinks(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListSinksRequest, dict]): The request object. The parameters to `ListSinks`. @@ -957,6 +1227,29 @@ async def get_sink(self, ) -> logging_config.LogSink: r"""Gets a sink. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + sink_name = f"projects/{project}/sinks/{sink}" + + request = logging_v2.GetSinkRequest( + sink_name=sink_name, + ) + + # Make the request + response = client.get_sink(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetSinkRequest, dict]): The request object. The parameters to `GetSink`. @@ -1059,6 +1352,35 @@ async def create_sink(self, permitted to write to the destination. A sink can export log entries only from the resource owning the sink. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + parent = f"projects/{project}/sinks/{sink}" + + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.CreateSinkRequest( + parent=parent, + sink=sink, + ) + + # Make the request + response = client.create_sink(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]): The request object. The parameters to `CreateSink`. @@ -1165,6 +1487,35 @@ async def update_sink(self, The updated sink might also have a new ``writer_identity``; see the ``unique_writer_identity`` field. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + sink_name = f"projects/{project}/sinks/{sink}" + + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.UpdateSinkRequest( + sink_name=sink_name, + sink=sink, + ) + + # Make the request + response = client.update_sink(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]): The request object. The parameters to `UpdateSink`. @@ -1295,6 +1646,27 @@ async def delete_sink(self, r"""Deletes a sink. If the sink has a unique ``writer_identity``, then that service account is also deleted. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + sink_name = f"projects/{project}/sinks/{sink}" + + request = logging_v2.DeleteSinkRequest( + sink_name=sink_name, + ) + + # Make the request + response = client.delete_sink(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]): The request object. The parameters to `DeleteSink`. @@ -1377,6 +1749,28 @@ async def list_exclusions(self, ) -> pagers.ListExclusionsAsyncPager: r"""Lists all the exclusions in a parent resource. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_exclusions(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + parent = f"projects/{project}/exclusions/{exclusion}" + + request = logging_v2.ListExclusionsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_exclusions(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]): The request object. The parameters to `ListExclusions`. @@ -1477,6 +1871,29 @@ async def get_exclusion(self, ) -> logging_config.LogExclusion: r"""Gets the description of an exclusion. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + name = f"projects/{project}/exclusions/{exclusion}" + + request = logging_v2.GetExclusionRequest( + name=name, + ) + + # Make the request + response = client.get_exclusion(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]): The request object. The parameters to `GetExclusion`. @@ -1581,6 +1998,35 @@ async def create_exclusion(self, can be excluded. You can have up to 10 exclusions in a resource. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + parent = f"projects/{project}/exclusions/{exclusion}" + + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.CreateExclusionRequest( + parent=parent, + exclusion=exclusion, + ) + + # Make the request + response = client.create_exclusion(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]): The request object. The parameters to `CreateExclusion`. @@ -1687,6 +2133,35 @@ async def update_exclusion(self, r"""Changes one or more properties of an existing exclusion. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + name = f"projects/{project}/exclusions/{exclusion}" + + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.UpdateExclusionRequest( + name=name, + exclusion=exclusion, + ) + + # Make the request + response = client.update_exclusion(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]): The request object. The parameters to `UpdateExclusion`. @@ -1805,6 +2280,26 @@ async def delete_exclusion(self, ) -> None: r"""Deletes an exclusion. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + name = f"projects/{project}/exclusions/{exclusion}" + + request = logging_v2.DeleteExclusionRequest( + name=name, + ) + + # Make the request + response = client.delete_exclusion(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]): The request object. The parameters to `DeleteExclusion`. @@ -1895,6 +2390,29 @@ async def get_cmek_settings(self, Router `__ for more information. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + name = f"projects/{project}/cmekSettings" + + request = logging_v2.GetCmekSettingsRequest( + name=name, + ) + + # Make the request + response = client.get_cmek_settings(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]): The request object. The parameters to @@ -1977,6 +2495,26 @@ async def update_cmek_settings(self, Router `__ for more information. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.UpdateCmekSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.update_cmek_settings(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]): The request object. The parameters to diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py index 377cfda453..9637c628dc 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py @@ -417,6 +417,30 @@ def list_buckets(self, ) -> pagers.ListBucketsPager: r"""Lists buckets. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_buckets(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + parent = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.ListBucketsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_buckets(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]): The request object. The parameters to `ListBuckets`. @@ -512,6 +536,31 @@ def get_bucket(self, ) -> logging_config.LogBucket: r"""Gets a bucket. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.GetBucketRequest( + name=name, + ) + + # Make the request + response = client.get_bucket(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetBucketRequest, dict]): The request object. The parameters to `GetBucket`. @@ -567,6 +616,33 @@ def create_bucket(self, entries. Once a bucket has been created, the region cannot be changed. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + parent = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.CreateBucketRequest( + parent=parent, + bucket_id="bucket_id_value", + ) + + # Make the request + response = client.create_bucket(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]): The request object. The parameters to `CreateBucket`. @@ -630,6 +706,32 @@ def update_bucket(self, A buckets region may not be modified after it is created. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.UpdateBucketRequest( + name=name, + ) + + # Make the request + response = client.update_bucket(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]): The request object. The parameters to `UpdateBucket`. @@ -685,6 +787,29 @@ def delete_bucket(self, state. After 7 days, the bucket will be purged and all logs in the bucket will be permanently deleted. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.DeleteBucketRequest( + name=name, + ) + + # Make the request + response = client.delete_bucket(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]): The request object. The parameters to `DeleteBucket`. @@ -732,6 +857,29 @@ def undelete_bucket(self, r"""Undeletes a bucket. A bucket that has been deleted may be undeleted within the grace period of 7 days. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_undelete_bucket(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}" + + request = logging_v2.UndeleteBucketRequest( + name=name, + ) + + # Make the request + response = client.undelete_bucket(request=request) + Args: request (Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]): The request object. The parameters to `UndeleteBucket`. @@ -779,6 +927,25 @@ def list_views(self, ) -> pagers.ListViewsPager: r"""Lists views on a bucket. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_views(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListViewsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_views(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListViewsRequest, dict]): The request object. The parameters to `ListViews`. @@ -866,6 +1033,32 @@ def get_view(self, ) -> logging_config.LogView: r"""Gets a view. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + view = "view_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" + + request = logging_v2.GetViewRequest( + name=name, + ) + + # Make the request + response = client.get_view(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetViewRequest, dict]): The request object. The parameters to `GetView`. @@ -922,6 +1115,28 @@ def create_view(self, r"""Creates a view over logs in a bucket. A bucket may contain a maximum of 50 views. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.CreateViewRequest( + parent="parent_value", + view_id="view_id_value", + ) + + # Make the request + response = client.create_view(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateViewRequest, dict]): The request object. The parameters to `CreateView`. @@ -978,6 +1193,27 @@ def update_view(self, r"""Updates a view. This method replaces the following fields in the existing view with values from the new view: ``filter``. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.UpdateViewRequest( + name="name_value", + ) + + # Make the request + response = client.update_view(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]): The request object. The parameters to `UpdateView`. @@ -1033,6 +1269,29 @@ def delete_view(self, ) -> None: r"""Deletes a view from a bucket. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + bucket = "bucket_value" + view = "view_value" + name = f"projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" + + request = logging_v2.DeleteViewRequest( + name=name, + ) + + # Make the request + response = client.delete_view(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]): The request object. The parameters to `DeleteView`. @@ -1080,6 +1339,29 @@ def list_sinks(self, ) -> pagers.ListSinksPager: r"""Lists sinks. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_sinks(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + parent = f"projects/{project}/sinks/{sink}" + + request = logging_v2.ListSinksRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_sinks(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListSinksRequest, dict]): The request object. The parameters to `ListSinks`. @@ -1172,6 +1454,30 @@ def get_sink(self, ) -> logging_config.LogSink: r"""Gets a sink. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + sink_name = f"projects/{project}/sinks/{sink}" + + request = logging_v2.GetSinkRequest( + sink_name=sink_name, + ) + + # Make the request + response = client.get_sink(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetSinkRequest, dict]): The request object. The parameters to `GetSink`. @@ -1266,6 +1572,36 @@ def create_sink(self, permitted to write to the destination. A sink can export log entries only from the resource owning the sink. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + parent = f"projects/{project}/sinks/{sink}" + + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.CreateSinkRequest( + parent=parent, + sink=sink, + ) + + # Make the request + response = client.create_sink(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]): The request object. The parameters to `CreateSink`. @@ -1372,6 +1708,36 @@ def update_sink(self, The updated sink might also have a new ``writer_identity``; see the ``unique_writer_identity`` field. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + sink_name = f"projects/{project}/sinks/{sink}" + + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.UpdateSinkRequest( + sink_name=sink_name, + sink=sink, + ) + + # Make the request + response = client.update_sink(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]): The request object. The parameters to `UpdateSink`. @@ -1494,6 +1860,28 @@ def delete_sink(self, r"""Deletes a sink. If the sink has a unique ``writer_identity``, then that service account is also deleted. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + sink = "sink_value" + sink_name = f"projects/{project}/sinks/{sink}" + + request = logging_v2.DeleteSinkRequest( + sink_name=sink_name, + ) + + # Make the request + response = client.delete_sink(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]): The request object. The parameters to `DeleteSink`. @@ -1568,6 +1956,29 @@ def list_exclusions(self, ) -> pagers.ListExclusionsPager: r"""Lists all the exclusions in a parent resource. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_exclusions(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + parent = f"projects/{project}/exclusions/{exclusion}" + + request = logging_v2.ListExclusionsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_exclusions(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]): The request object. The parameters to `ListExclusions`. @@ -1660,6 +2071,30 @@ def get_exclusion(self, ) -> logging_config.LogExclusion: r"""Gets the description of an exclusion. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + name = f"projects/{project}/exclusions/{exclusion}" + + request = logging_v2.GetExclusionRequest( + name=name, + ) + + # Make the request + response = client.get_exclusion(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]): The request object. The parameters to `GetExclusion`. @@ -1756,6 +2191,36 @@ def create_exclusion(self, can be excluded. You can have up to 10 exclusions in a resource. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + parent = f"projects/{project}/exclusions/{exclusion}" + + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.CreateExclusionRequest( + parent=parent, + exclusion=exclusion, + ) + + # Make the request + response = client.create_exclusion(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]): The request object. The parameters to `CreateExclusion`. @@ -1862,6 +2327,36 @@ def update_exclusion(self, r"""Changes one or more properties of an existing exclusion. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + name = f"projects/{project}/exclusions/{exclusion}" + + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.UpdateExclusionRequest( + name=name, + exclusion=exclusion, + ) + + # Make the request + response = client.update_exclusion(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]): The request object. The parameters to `UpdateExclusion`. @@ -1980,6 +2475,27 @@ def delete_exclusion(self, ) -> None: r"""Deletes an exclusion. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + exclusion = "exclusion_value" + name = f"projects/{project}/exclusions/{exclusion}" + + request = logging_v2.DeleteExclusionRequest( + name=name, + ) + + # Make the request + response = client.delete_exclusion(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]): The request object. The parameters to `DeleteExclusion`. @@ -2062,6 +2578,30 @@ def get_cmek_settings(self, Router `__ for more information. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + name = f"projects/{project}/cmekSettings" + + request = logging_v2.GetCmekSettingsRequest( + name=name, + ) + + # Make the request + response = client.get_cmek_settings(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]): The request object. The parameters to @@ -2145,6 +2685,27 @@ def update_cmek_settings(self, Router `__ for more information. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.UpdateCmekSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.update_cmek_settings(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]): The request object. The parameters to diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py index b5ee66a099..bf764a2603 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py @@ -199,6 +199,27 @@ async def delete_log(self, deleted. Entries received after the delete operation with a timestamp before the operation will be deleted. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_log(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + log = "log_value" + log_name = f"projects/{project}/logs/{log}" + + request = logging_v2.DeleteLogRequest( + log_name=log_name, + ) + + # Make the request + response = client.delete_log(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]): The request object. The parameters to DeleteLog. @@ -293,6 +314,29 @@ async def write_log_entries(self, maximum of 1000 different resources (projects, organizations, billing accounts or folders) + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_write_log_entries(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + entries = logging_v2.LogEntry() + entries.log_name = "log_name_value" + + request = logging_v2.WriteLogEntriesRequest( + entries=entries, + ) + + # Make the request + response = client.write_log_entries(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]): The request object. The parameters to WriteLogEntries. @@ -458,6 +502,29 @@ async def list_log_entries(self, For ways to export log entries, see `Exporting Logs `__. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_log_entries(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + log = "log_value" + resource_names = f"projects/{project}/logs/{log}" + + request = logging_v2.ListLogEntriesRequest( + resource_names=resource_names, + ) + + # Make the request + page_result = client.list_log_entries(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]): The request object. The parameters to `ListLogEntries`. @@ -590,6 +657,24 @@ async def list_monitored_resource_descriptors(self, r"""Lists the descriptors for monitored resource types used by Logging. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_monitored_resource_descriptors(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListMonitoredResourceDescriptorsRequest( + ) + + # Make the request + page_result = client.list_monitored_resource_descriptors(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]): The request object. The parameters to @@ -660,6 +745,29 @@ async def list_logs(self, or billing accounts. Only logs that have entries are listed. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_logs(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + log = "log_value" + parent = f"projects/{project}/logs/{log}" + + request = logging_v2.ListLogsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_logs(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListLogsRequest, dict]): The request object. The parameters to ListLogs. @@ -760,6 +868,34 @@ def tail_log_entries(self, Until the stream is terminated, it will continue reading logs. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_tail_log_entries(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.TailLogEntriesRequest( + resource_names=['resource_names_value_1', 'resource_names_value_2'], + ) + + # This method expects an iterator which contains + # 'logging_v2.TailLogEntriesRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.tail_log_entries(requests=request_generator()) + for response in stream: + print(response) + Args: requests (AsyncIterator[`google.cloud.logging_v2.types.TailLogEntriesRequest`]): The request object AsyncIterator. The parameters to `TailLogEntries`. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py index 6b5478a60f..fc7e8aed39 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py @@ -377,6 +377,28 @@ def delete_log(self, deleted. Entries received after the delete operation with a timestamp before the operation will be deleted. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_log(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + log = "log_value" + log_name = f"projects/{project}/logs/{log}" + + request = logging_v2.DeleteLogRequest( + log_name=log_name, + ) + + # Make the request + response = client.delete_log(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]): The request object. The parameters to DeleteLog. @@ -463,6 +485,30 @@ def write_log_entries(self, maximum of 1000 different resources (projects, organizations, billing accounts or folders) + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_write_log_entries(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + entries = logging_v2.LogEntry() + entries.log_name = "log_name_value" + + request = logging_v2.WriteLogEntriesRequest( + entries=entries, + ) + + # Make the request + response = client.write_log_entries(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]): The request object. The parameters to WriteLogEntries. @@ -619,6 +665,30 @@ def list_log_entries(self, For ways to export log entries, see `Exporting Logs `__. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_log_entries(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + log = "log_value" + resource_names = f"projects/{project}/logs/{log}" + + request = logging_v2.ListLogEntriesRequest( + resource_names=resource_names, + ) + + # Make the request + page_result = client.list_log_entries(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]): The request object. The parameters to `ListLogEntries`. @@ -743,6 +813,25 @@ def list_monitored_resource_descriptors(self, r"""Lists the descriptors for monitored resource types used by Logging. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_monitored_resource_descriptors(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListMonitoredResourceDescriptorsRequest( + ) + + # Make the request + page_result = client.list_monitored_resource_descriptors(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]): The request object. The parameters to @@ -806,6 +895,30 @@ def list_logs(self, or billing accounts. Only logs that have entries are listed. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_logs(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + log = "log_value" + parent = f"projects/{project}/logs/{log}" + + request = logging_v2.ListLogsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_logs(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListLogsRequest, dict]): The request object. The parameters to ListLogs. @@ -898,6 +1011,35 @@ def tail_log_entries(self, Until the stream is terminated, it will continue reading logs. + + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_tail_log_entries(): + # Create a client + client = logging_v2.LoggingServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.TailLogEntriesRequest( + resource_names=['resource_names_value_1', 'resource_names_value_2'], + ) + + # This method expects an iterator which contains + # 'logging_v2.TailLogEntriesRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.tail_log_entries(requests=request_generator()) + for response in stream: + print(response) + Args: requests (Iterator[google.cloud.logging_v2.types.TailLogEntriesRequest]): The request object iterator. The parameters to `TailLogEntries`. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py index b64d742352..bd8825626b 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py @@ -196,6 +196,27 @@ async def list_log_metrics(self, ) -> pagers.ListLogMetricsAsyncPager: r"""Lists logs-based metrics. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_log_metrics(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + parent = f"projects/{project}" + + request = logging_v2.ListLogMetricsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_log_metrics(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]): The request object. The parameters to ListLogMetrics. @@ -293,6 +314,29 @@ async def get_log_metric(self, ) -> logging_metrics.LogMetric: r"""Gets a logs-based metric. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + metric_name = f"projects/{project}/metrics/{metric}" + + request = logging_v2.GetLogMetricRequest( + metric_name=metric_name, + ) + + # Make the request + response = client.get_log_metric(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]): The request object. The parameters to GetLogMetric. @@ -388,6 +432,34 @@ async def create_log_metric(self, ) -> logging_metrics.LogMetric: r"""Creates a logs-based metric. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + parent = f"projects/{project}/metrics/{metric}" + + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.CreateLogMetricRequest( + parent=parent, + metric=metric, + ) + + # Make the request + response = client.create_log_metric(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]): The request object. The parameters to CreateLogMetric. @@ -488,6 +560,34 @@ async def update_log_metric(self, ) -> logging_metrics.LogMetric: r"""Creates or updates a logs-based metric. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + metric_name = f"projects/{project}/metrics/{metric}" + + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.UpdateLogMetricRequest( + metric_name=metric_name, + metric=metric, + ) + + # Make the request + response = client.update_log_metric(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]): The request object. The parameters to UpdateLogMetric. @@ -594,6 +694,26 @@ async def delete_log_metric(self, ) -> None: r"""Deletes a logs-based metric. + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + metric_name = f"projects/{project}/metrics/{metric}" + + request = logging_v2.DeleteLogMetricRequest( + metric_name=metric_name, + ) + + # Make the request + response = client.delete_log_metric(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]): The request object. The parameters to DeleteLogMetric. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py index e13a49a695..c5575d5418 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py @@ -374,6 +374,28 @@ def list_log_metrics(self, ) -> pagers.ListLogMetricsPager: r"""Lists logs-based metrics. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_list_log_metrics(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + parent = f"projects/{project}" + + request = logging_v2.ListLogMetricsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_log_metrics(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]): The request object. The parameters to ListLogMetrics. @@ -463,6 +485,30 @@ def get_log_metric(self, ) -> logging_metrics.LogMetric: r"""Gets a logs-based metric. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_get_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + metric_name = f"projects/{project}/metrics/{metric}" + + request = logging_v2.GetLogMetricRequest( + metric_name=metric_name, + ) + + # Make the request + response = client.get_log_metric(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]): The request object. The parameters to GetLogMetric. @@ -550,6 +596,35 @@ def create_log_metric(self, ) -> logging_metrics.LogMetric: r"""Creates a logs-based metric. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_create_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + parent = f"projects/{project}/metrics/{metric}" + + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.CreateLogMetricRequest( + parent=parent, + metric=metric, + ) + + # Make the request + response = client.create_log_metric(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]): The request object. The parameters to CreateLogMetric. @@ -650,6 +725,35 @@ def update_log_metric(self, ) -> logging_metrics.LogMetric: r"""Creates or updates a logs-based metric. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_update_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + metric_name = f"projects/{project}/metrics/{metric}" + + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.UpdateLogMetricRequest( + metric_name=metric_name, + metric=metric, + ) + + # Make the request + response = client.update_log_metric(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]): The request object. The parameters to UpdateLogMetric. @@ -748,6 +852,27 @@ def delete_log_metric(self, ) -> None: r"""Deletes a logs-based metric. + + .. code-block:: + + from google.cloud import logging_v2 + + def sample_delete_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + project = "my-project-id" + metric = "metric_value" + metric_name = f"projects/{project}/metrics/{metric}" + + request = logging_v2.DeleteLogMetricRequest( + metric_name=metric_name, + ) + + # Make the request + response = client.delete_log_metric(request=request) + Args: request (Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]): The request object. The parameters to DeleteLogMetric. 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 index 69dbb78e0b..3931b1d669 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_create_bucket(): - """Snippet for create_bucket""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_sync.py index 5aab6d3877..b850efd1fb 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_bucket_sync.py @@ -28,8 +28,6 @@ def sample_create_bucket(): - """Snippet for create_bucket""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 331d889862..432f9d86a8 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_create_exclusion(): - """Snippet for create_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py index 340489a851..e17a5e04e7 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py @@ -28,8 +28,6 @@ def sample_create_exclusion(): - """Snippet for create_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 72862fea5f..5d2bfcf7d2 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_create_sink(): - """Snippet for create_sink""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_sync.py index 8952205a4d..372a22657b 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_sink_sync.py @@ -28,8 +28,6 @@ def sample_create_sink(): - """Snippet for create_sink""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 555d13d0cb..4cd7a79399 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_create_view(): - """Snippet for create_view""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_sync.py index 518426012d..562fb087b8 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_create_view_sync.py @@ -28,8 +28,6 @@ def sample_create_view(): - """Snippet for create_view""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 6f4783434a..0ff377493e 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_bucket(): - """Snippet for delete_bucket""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py index 05caf82171..b3cc0f22fc 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py @@ -28,8 +28,6 @@ def sample_delete_bucket(): - """Snippet for delete_bucket""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 9dc81ab344..f51384574e 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_exclusion(): - """Snippet for delete_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py index 06234bd4c5..f4fd093b5a 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py @@ -28,8 +28,6 @@ def sample_delete_exclusion(): - """Snippet for delete_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 9c16d136bd..35c3144c6c 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_sink(): - """Snippet for delete_sink""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_sync.py index 03967671a2..ec1cf8acd2 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_sink_sync.py @@ -28,8 +28,6 @@ def sample_delete_sink(): - """Snippet for delete_sink""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index da713a45c1..596d0ab208 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_view(): - """Snippet for delete_view""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_sync.py index 6e228b20c4..f65d86c656 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_delete_view_sync.py @@ -28,8 +28,6 @@ def sample_delete_view(): - """Snippet for delete_view""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 450137ed52..e716961730 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_bucket(): - """Snippet for get_bucket""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_sync.py index 2ca4765dc9..5a84535f23 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_bucket_sync.py @@ -28,8 +28,6 @@ def sample_get_bucket(): - """Snippet for get_bucket""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 46dbf2c232..6335aa131f 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_cmek_settings(): - """Snippet for get_cmek_settings""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py index 8aafd34f49..f7109b8dd0 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py @@ -28,8 +28,6 @@ def sample_get_cmek_settings(): - """Snippet for get_cmek_settings""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index d32f262506..461762b5a1 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_exclusion(): - """Snippet for get_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py index 4e80012a4a..9a99f3a884 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py @@ -28,8 +28,6 @@ def sample_get_exclusion(): - """Snippet for get_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index b92d24eefa..fac7632db4 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_sink(): - """Snippet for get_sink""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_sync.py index 008e2455ab..b18072a4e1 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_sink_sync.py @@ -28,8 +28,6 @@ def sample_get_sink(): - """Snippet for get_sink""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 8b76d7edbd..08d07c7536 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_view(): - """Snippet for get_view""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_sync.py index 0e21b01699..775157e1df 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_get_view_sync.py @@ -28,8 +28,6 @@ def sample_get_view(): - """Snippet for get_view""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index a530c83b5c..d2ed2615b2 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_buckets(): - """Snippet for list_buckets""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_sync.py index c6d6297947..3824790fe5 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_buckets_sync.py @@ -28,8 +28,6 @@ def sample_list_buckets(): - """Snippet for list_buckets""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 1a9db61555..f8efb65633 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_exclusions(): - """Snippet for list_exclusions""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py index 19ccc14f56..ea485dd383 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py @@ -28,8 +28,6 @@ def sample_list_exclusions(): - """Snippet for list_exclusions""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 739cb31262..87098906f3 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_sinks(): - """Snippet for list_sinks""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_sync.py index 534f3e9f27..c4ed69141c 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_sinks_sync.py @@ -28,8 +28,6 @@ def sample_list_sinks(): - """Snippet for list_sinks""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index a4843f371e..f53490638e 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_views(): - """Snippet for list_views""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_sync.py index d32a0aa110..4ae6c7d60f 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_list_views_sync.py @@ -28,8 +28,6 @@ def sample_list_views(): - """Snippet for list_views""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 5fa49940a1..8a8161028f 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_undelete_bucket(): - """Snippet for undelete_bucket""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py index c2804473a5..d9a11f45dd 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py @@ -28,8 +28,6 @@ def sample_undelete_bucket(): - """Snippet for undelete_bucket""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index bd49a32b7f..595c4a8ffa 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_bucket(): - """Snippet for update_bucket""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_sync.py index de20ddf1e1..cb294ae3f6 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_bucket_sync.py @@ -28,8 +28,6 @@ def sample_update_bucket(): - """Snippet for update_bucket""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index cd01d5b04a..74e24c67a7 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_cmek_settings(): - """Snippet for update_cmek_settings""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py index a679dfa441..5e19a86ba4 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py @@ -28,8 +28,6 @@ def sample_update_cmek_settings(): - """Snippet for update_cmek_settings""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 60d503ac15..b4d79d2d76 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_exclusion(): - """Snippet for update_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py index 48726f9222..a3772807ba 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py @@ -28,8 +28,6 @@ def sample_update_exclusion(): - """Snippet for update_exclusion""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 096a88890b..d43e5ac5e4 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_sink(): - """Snippet for update_sink""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_sync.py index 3597759584..ca50c1e353 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_sink_sync.py @@ -28,8 +28,6 @@ def sample_update_sink(): - """Snippet for update_sink""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 5177171f8f..3d4681021c 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_view(): - """Snippet for update_view""" - # Create a client client = logging_v2.ConfigServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_sync.py index 164e01f49b..9f134431d0 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_config_service_v2_update_view_sync.py @@ -28,8 +28,6 @@ def sample_update_view(): - """Snippet for update_view""" - # Create a client client = logging_v2.ConfigServiceV2Client() 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 index 1c9bc101aa..25f13bae6a 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_log(): - """Snippet for delete_log""" - # Create a client client = logging_v2.LoggingServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_sync.py index 0b329d55a6..daa5767c49 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_delete_log_sync.py @@ -28,8 +28,6 @@ def sample_delete_log(): - """Snippet for delete_log""" - # Create a client client = logging_v2.LoggingServiceV2Client() 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 index ac069139a6..fb156a9757 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_log_entries(): - """Snippet for list_log_entries""" - # Create a client client = logging_v2.LoggingServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py index 227e887f0e..74968ae551 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py @@ -28,8 +28,6 @@ def sample_list_log_entries(): - """Snippet for list_log_entries""" - # Create a client client = logging_v2.LoggingServiceV2Client() 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 index 2fe01050d2..17362e9d17 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_logs(): - """Snippet for list_logs""" - # Create a client client = logging_v2.LoggingServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_sync.py index 5c619ad49d..12491dadf8 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_logs_sync.py @@ -28,8 +28,6 @@ def sample_list_logs(): - """Snippet for list_logs""" - # Create a client client = logging_v2.LoggingServiceV2Client() 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 index 6734d6a5c8..35fd5d0b00 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_monitored_resource_descriptors(): - """Snippet for list_monitored_resource_descriptors""" - # Create a client client = logging_v2.LoggingServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py index 89da0c9c67..05cdb4a5aa 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py @@ -28,8 +28,6 @@ def sample_list_monitored_resource_descriptors(): - """Snippet for list_monitored_resource_descriptors""" - # Create a client client = logging_v2.LoggingServiceV2Client() 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 index 1c6e1db5be..6ddc30b036 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_tail_log_entries(): - """Snippet for tail_log_entries""" - # Create a client client = logging_v2.LoggingServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py index e9a5dfc2ec..c01d944a8f 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py @@ -28,8 +28,6 @@ def sample_tail_log_entries(): - """Snippet for tail_log_entries""" - # Create a client client = logging_v2.LoggingServiceV2Client() 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 index 71120d98a2..5e019280f3 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_write_log_entries(): - """Snippet for write_log_entries""" - # Create a client client = logging_v2.LoggingServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py index 7da931be50..9e03979e5c 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py @@ -28,8 +28,6 @@ def sample_write_log_entries(): - """Snippet for write_log_entries""" - # Create a client client = logging_v2.LoggingServiceV2Client() 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 index de5a085dda..212444858d 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_create_log_metric(): - """Snippet for create_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py index e3bd08822c..e81eb133b4 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py @@ -28,8 +28,6 @@ def sample_create_log_metric(): - """Snippet for create_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2Client() 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 index 5ed7562551..876f2bbad8 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_log_metric(): - """Snippet for delete_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py index 012322113c..fb2eb6f897 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py @@ -28,8 +28,6 @@ def sample_delete_log_metric(): - """Snippet for delete_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2Client() 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 index cc0f0c5536..a9b77fe6fb 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_log_metric(): - """Snippet for get_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py index fb8499456f..4e18e335b9 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py @@ -28,8 +28,6 @@ def sample_get_log_metric(): - """Snippet for get_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2Client() 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 index c640c59724..5742806d0d 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_log_metrics(): - """Snippet for list_log_metrics""" - # Create a client client = logging_v2.MetricsServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py index 734d4c869b..9741359810 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py @@ -28,8 +28,6 @@ def sample_list_log_metrics(): - """Snippet for list_log_metrics""" - # Create a client client = logging_v2.MetricsServiceV2Client() 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 index 05fb745bb7..dcb6465393 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_log_metric(): - """Snippet for update_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2AsyncClient() diff --git a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py index 6e37f22e59..ad87904dc2 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py +++ b/tests/integration/goldens/logging/samples/generated_samples/logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py @@ -28,8 +28,6 @@ def sample_update_log_metric(): - """Snippet for update_log_metric""" - # Create a client client = logging_v2.MetricsServiceV2Client() diff --git a/tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_logging_v2.json b/tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_logging_v2.json new file mode 100644 index 0000000000..c5479a62a7 --- /dev/null +++ b/tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_logging_v2.json @@ -0,0 +1,2966 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_bucket_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateBucket_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_bucket_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateBucket_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_exclusion_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_exclusion_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateExclusion_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_sink_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateSink_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_sink_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateSink_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_view_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateView_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "CreateView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_create_view_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_CreateView_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_bucket_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_bucket_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteBucket_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_exclusion_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_exclusion_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteExclusion_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_sink_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteSink_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_sink_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteSink_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_view_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteView_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "DeleteView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_delete_view_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_DeleteView_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_bucket_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetBucket_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_bucket_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetBucket_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetCmekSettings" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_cmek_settings_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetCmekSettings" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_cmek_settings_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetCmekSettings_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_exclusion_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetExclusion_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_exclusion_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetExclusion_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_sink_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetSink_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_sink_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetSink_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_view_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetView_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "GetView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_get_view_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_GetView_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListBuckets" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_buckets_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListBuckets_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListBuckets" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_buckets_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListBuckets_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListExclusions" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_exclusions_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListExclusions_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListExclusions" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_exclusions_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListExclusions_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListSinks" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_sinks_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListSinks_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListSinks" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_sinks_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListSinks_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListViews" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_views_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListViews_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "ListViews" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_list_views_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_ListViews_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UndeleteBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_undelete_bucket_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UndeleteBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_undelete_bucket_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UndeleteBucket_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_bucket_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateBucket" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_bucket_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateBucket_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateCmekSettings" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_cmek_settings_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateCmekSettings" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_cmek_settings_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateCmekSettings_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_exclusion_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateExclusion" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_exclusion_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateExclusion_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_sink_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateSink_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateSink" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_sink_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateSink_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_view_async.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateView_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ConfigServiceV2" + }, + "shortName": "UpdateView" + } + }, + "file": "logging_generated_logging_v2_config_service_v2_update_view_sync.py", + "regionTag": "logging_generated_logging_v2_ConfigServiceV2_UpdateView_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "DeleteLog" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_delete_log_async.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_DeleteLog_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "DeleteLog" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_delete_log_sync.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_DeleteLog_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "ListLogEntries" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_list_log_entries_async.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "ListLogEntries" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_list_log_entries_sync.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_ListLogEntries_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "ListLogs" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_list_logs_async.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_ListLogs_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "ListLogs" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_list_logs_sync.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_ListLogs_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "ListMonitoredResourceDescriptors" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_async.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "ListMonitoredResourceDescriptors" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_list_monitored_resource_descriptors_sync.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_ListMonitoredResourceDescriptors_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "TailLogEntries" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_tail_log_entries_async.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "TailLogEntries" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_tail_log_entries_sync.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_TailLogEntries_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "WriteLogEntries" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_write_log_entries_async.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "LoggingServiceV2" + }, + "shortName": "WriteLogEntries" + } + }, + "file": "logging_generated_logging_v2_logging_service_v2_write_log_entries_sync.py", + "regionTag": "logging_generated_logging_v2_LoggingServiceV2_WriteLogEntries_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "CreateLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_create_log_metric_async.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "CreateLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_create_log_metric_sync.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_CreateLogMetric_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "DeleteLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_delete_log_metric_async.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "DeleteLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_delete_log_metric_sync.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_DeleteLogMetric_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "GetLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_get_log_metric_async.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "GetLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_get_log_metric_sync.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_GetLogMetric_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "ListLogMetrics" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_list_log_metrics_async.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "ListLogMetrics" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_list_log_metrics_sync.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_ListLogMetrics_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 41, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 42, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "UpdateLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_update_log_metric_async.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MetricsServiceV2" + }, + "shortName": "UpdateLogMetric" + } + }, + "file": "logging_generated_logging_v2_metrics_service_v2_update_log_metric_sync.py", + "regionTag": "logging_generated_logging_v2_MetricsServiceV2_UpdateLogMetric_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py index 7ad1b6a796..2c17838465 100644 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py @@ -228,6 +228,29 @@ async def list_instances(self, regions available to the project are queried, and the results are aggregated. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_list_instances(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + parent = f"projects/{project}/locations/{location}" + + request = redis_v1.ListInstancesRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_instances(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.redis_v1.types.ListInstancesRequest, dict]): The request object. Request for @@ -317,6 +340,30 @@ async def get_instance(self, ) -> cloud_redis.Instance: r"""Gets the details of a specific Redis instance. + .. code-block:: + + from google.cloud import redis_v1 + + def sample_get_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.GetInstanceRequest( + name=name, + ) + + # Make the request + response = client.get_instance(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.redis_v1.types.GetInstanceRequest, dict]): The request object. Request for @@ -406,6 +453,39 @@ async def create_instance(self, The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_create_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + parent = f"projects/{project}/locations/{location}" + + instance = redis_v1.Instance() + instance.name = "name_value" + instance.tier = "STANDARD_HA" + instance.memory_size_gb = 1499 + + request = redis_v1.CreateInstanceRequest( + parent=parent, + instance_id="instance_id_value", + instance=instance, + ) + + # Make the request + operation = client.create_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.CreateInstanceRequest, dict]): The request object. Request for @@ -523,6 +603,33 @@ async def update_instance(self, operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_update_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + instance = redis_v1.Instance() + instance.name = "name_value" + instance.tier = "STANDARD_HA" + instance.memory_size_gb = 1499 + + request = redis_v1.UpdateInstanceRequest( + instance=instance, + ) + + # Make the request + operation = client.update_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.UpdateInstanceRequest, dict]): The request object. Request for @@ -627,6 +734,34 @@ async def upgrade_instance(self, r"""Upgrades Redis instance to the newer Redis version specified in the request. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_upgrade_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.UpgradeInstanceRequest( + name=name, + redis_version="redis_version_value", + ) + + # Make the request + operation = client.upgrade_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.UpgradeInstanceRequest, dict]): The request object. Request for @@ -732,6 +867,32 @@ async def import_instance(self, The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_import_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + input_config = redis_v1.InputConfig() + input_config.gcs_source.uri = "uri_value" + + request = redis_v1.ImportInstanceRequest( + name="name_value", + input_config=input_config, + ) + + # Make the request + operation = client.import_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.ImportInstanceRequest, dict]): The request object. Request for @@ -833,6 +994,32 @@ async def export_instance(self, The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_export_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + output_config = redis_v1.OutputConfig() + output_config.gcs_destination.uri = "uri_value" + + request = redis_v1.ExportInstanceRequest( + name="name_value", + output_config=output_config, + ) + + # Make the request + operation = client.export_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.ExportInstanceRequest, dict]): The request object. Request for @@ -932,6 +1119,33 @@ async def failover_instance(self, replica node for a specific STANDARD tier Cloud Memorystore for Redis instance. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_failover_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.FailoverInstanceRequest( + name=name, + ) + + # Make the request + operation = client.failover_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.FailoverInstanceRequest, dict]): The request object. Request for @@ -1030,6 +1244,33 @@ async def delete_instance(self, r"""Deletes a specific Redis instance. Instance stops serving and data is deleted. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_delete_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.DeleteInstanceRequest( + name=name, + ) + + # Make the request + operation = client.delete_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.DeleteInstanceRequest, dict]): The request object. Request for diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py index 067f20f271..6f2397c493 100644 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py @@ -406,6 +406,30 @@ def list_instances(self, regions available to the project are queried, and the results are aggregated. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_list_instances(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + parent = f"projects/{project}/locations/{location}" + + request = redis_v1.ListInstancesRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_instances(request=request) + for response in page_result: + print(response) + Args: request (Union[google.cloud.redis_v1.types.ListInstancesRequest, dict]): The request object. Request for @@ -495,6 +519,31 @@ def get_instance(self, ) -> cloud_redis.Instance: r"""Gets the details of a specific Redis instance. + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_get_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.GetInstanceRequest( + name=name, + ) + + # Make the request + response = client.get_instance(request=request) + + # Handle response + print(response) + Args: request (Union[google.cloud.redis_v1.types.GetInstanceRequest, dict]): The request object. Request for @@ -584,6 +633,40 @@ def create_instance(self, The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_create_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + parent = f"projects/{project}/locations/{location}" + + instance = redis_v1.Instance() + instance.name = "name_value" + instance.tier = "STANDARD_HA" + instance.memory_size_gb = 1499 + + request = redis_v1.CreateInstanceRequest( + parent=parent, + instance_id="instance_id_value", + instance=instance, + ) + + # Make the request + operation = client.create_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.CreateInstanceRequest, dict]): The request object. Request for @@ -701,6 +784,34 @@ def update_instance(self, operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_update_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + instance = redis_v1.Instance() + instance.name = "name_value" + instance.tier = "STANDARD_HA" + instance.memory_size_gb = 1499 + + request = redis_v1.UpdateInstanceRequest( + instance=instance, + ) + + # Make the request + operation = client.update_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.UpdateInstanceRequest, dict]): The request object. Request for @@ -805,6 +916,35 @@ def upgrade_instance(self, r"""Upgrades Redis instance to the newer Redis version specified in the request. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_upgrade_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.UpgradeInstanceRequest( + name=name, + redis_version="redis_version_value", + ) + + # Make the request + operation = client.upgrade_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.UpgradeInstanceRequest, dict]): The request object. Request for @@ -910,6 +1050,33 @@ def import_instance(self, The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_import_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + input_config = redis_v1.InputConfig() + input_config.gcs_source.uri = "uri_value" + + request = redis_v1.ImportInstanceRequest( + name="name_value", + input_config=input_config, + ) + + # Make the request + operation = client.import_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.ImportInstanceRequest, dict]): The request object. Request for @@ -1011,6 +1178,33 @@ def export_instance(self, The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_export_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + output_config = redis_v1.OutputConfig() + output_config.gcs_destination.uri = "uri_value" + + request = redis_v1.ExportInstanceRequest( + name="name_value", + output_config=output_config, + ) + + # Make the request + operation = client.export_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.ExportInstanceRequest, dict]): The request object. Request for @@ -1110,6 +1304,34 @@ def failover_instance(self, replica node for a specific STANDARD tier Cloud Memorystore for Redis instance. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_failover_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.FailoverInstanceRequest( + name=name, + ) + + # Make the request + operation = client.failover_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.FailoverInstanceRequest, dict]): The request object. Request for @@ -1208,6 +1430,34 @@ def delete_instance(self, r"""Deletes a specific Redis instance. Instance stops serving and data is deleted. + + + .. code-block:: + + from google.cloud import redis_v1 + + def sample_delete_instance(): + # Create a client + client = redis_v1.CloudRedisClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + instance = "instance_value" + name = f"projects/{project}/locations/{location}/instances/{instance}" + + request = redis_v1.DeleteInstanceRequest( + name=name, + ) + + # Make the request + operation = client.delete_instance(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + Args: request (Union[google.cloud.redis_v1.types.DeleteInstanceRequest, dict]): The request object. Request for 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 index 46b59320bf..39fb9f169c 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_create_instance(): - """Snippet for create_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_sync.py index c0b84c7c52..fee1cc58b1 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_create_instance_sync.py @@ -28,8 +28,6 @@ def sample_create_instance(): - """Snippet for create_instance""" - # Create a client client = redis_v1.CloudRedisClient() 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 index b63f325b09..0447c772f5 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_delete_instance(): - """Snippet for delete_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_sync.py index 5a081bbc7f..20970e507f 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_delete_instance_sync.py @@ -28,8 +28,6 @@ def sample_delete_instance(): - """Snippet for delete_instance""" - # Create a client client = redis_v1.CloudRedisClient() 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 index 302890bb28..22bcf3e413 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_export_instance(): - """Snippet for export_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_sync.py index adadccb214..3524ddc9aa 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_export_instance_sync.py @@ -28,8 +28,6 @@ def sample_export_instance(): - """Snippet for export_instance""" - # Create a client client = redis_v1.CloudRedisClient() 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 index c89d149c4c..d0ce830de5 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_failover_instance(): - """Snippet for failover_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_sync.py index 22295a3f6e..f322e8f0cf 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_failover_instance_sync.py @@ -28,8 +28,6 @@ def sample_failover_instance(): - """Snippet for failover_instance""" - # Create a client client = redis_v1.CloudRedisClient() 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 index 4a024f308e..6be04525a9 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_get_instance(): - """Snippet for get_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_sync.py index 5ea1e2f7fc..f6c3a5e4f5 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_get_instance_sync.py @@ -28,8 +28,6 @@ def sample_get_instance(): - """Snippet for get_instance""" - # Create a client client = redis_v1.CloudRedisClient() 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 index 739afbf6b0..f1a65c3e09 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_import_instance(): - """Snippet for import_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_sync.py index 2f03a78c6f..e246a349ca 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_import_instance_sync.py @@ -28,8 +28,6 @@ def sample_import_instance(): - """Snippet for import_instance""" - # Create a client client = redis_v1.CloudRedisClient() 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 index 60ae031bf2..35153ea3ff 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_instances(): - """Snippet for list_instances""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_sync.py index f428f6a9e1..6df89ddf35 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_list_instances_sync.py @@ -28,8 +28,6 @@ def sample_list_instances(): - """Snippet for list_instances""" - # Create a client client = redis_v1.CloudRedisClient() 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 index 3ecf913760..89af4b83b5 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_update_instance(): - """Snippet for update_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_sync.py index 16da68c748..83a3b74764 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_update_instance_sync.py @@ -28,8 +28,6 @@ def sample_update_instance(): - """Snippet for update_instance""" - # Create a client client = redis_v1.CloudRedisClient() 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 index c00e66a579..5b23157fd2 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_upgrade_instance(): - """Snippet for upgrade_instance""" - # Create a client client = redis_v1.CloudRedisAsyncClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py index 77052b6d55..602c18ffdc 100644 --- a/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py +++ b/tests/integration/goldens/redis/samples/generated_samples/redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py @@ -28,8 +28,6 @@ def sample_upgrade_instance(): - """Snippet for upgrade_instance""" - # Create a client client = redis_v1.CloudRedisClient() diff --git a/tests/integration/goldens/redis/samples/generated_samples/snippet_metadata_redis_v1.json b/tests/integration/goldens/redis/samples/generated_samples/snippet_metadata_redis_v1.json new file mode 100644 index 0000000000..9237cc8828 --- /dev/null +++ b/tests/integration/goldens/redis/samples/generated_samples/snippet_metadata_redis_v1.json @@ -0,0 +1,773 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "CreateInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_create_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_CreateInstance_async", + "segments": [ + { + "end": 57, + "start": 27, + "type": "FULL" + }, + { + "end": 57, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 58, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "CreateInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_create_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_CreateInstance_sync", + "segments": [ + { + "end": 57, + "start": 27, + "type": "FULL" + }, + { + "end": 57, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 58, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "DeleteInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_delete_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_DeleteInstance_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "DeleteInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_delete_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_DeleteInstance_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "ExportInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_export_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_ExportInstance_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "ExportInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_export_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_ExportInstance_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "FailoverInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_failover_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_FailoverInstance_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "FailoverInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_failover_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_FailoverInstance_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "GetInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_get_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_GetInstance_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "GetInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_get_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_GetInstance_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "ImportInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_import_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_ImportInstance_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "ImportInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_import_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_ImportInstance_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "ListInstances" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_list_instances_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_ListInstances_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "ListInstances" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_list_instances_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_ListInstances_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "UpdateInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_update_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_UpdateInstance_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "UpdateInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_update_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_UpdateInstance_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "UpgradeInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_upgrade_instance_async.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_UpgradeInstance_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudRedis" + }, + "shortName": "UpgradeInstance" + } + }, + "file": "redis_generated_redis_v1_cloud_redis_upgrade_instance_sync.py", + "regionTag": "redis_generated_redis_v1_CloudRedis_UpgradeInstance_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} 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 index 649e56a88b..a0be0b9e2b 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_list_resources(): - """Snippet for list_resources""" - # Create a client client = mollusca_v1.SnippetsAsyncClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py index 8892452b84..ddab64b202 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py @@ -28,8 +28,6 @@ def sample_list_resources(): - """Snippet for list_resources""" - # Create a client client = mollusca_v1.SnippetsClient() 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 index 7e9605052e..2e0013366b 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_method_bidi_streaming(): - """Snippet for method_bidi_streaming""" - # Create a client client = mollusca_v1.SnippetsAsyncClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py index 269fe19732..50981f2356 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py @@ -28,8 +28,6 @@ def sample_method_bidi_streaming(): - """Snippet for method_bidi_streaming""" - # Create a client client = mollusca_v1.SnippetsClient() 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 index 392241b5e2..a66fcd660a 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_method_lro_signatures(): - """Snippet for method_lro_signatures""" - # Create a client client = mollusca_v1.SnippetsAsyncClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py index e0fa332206..2a8fd20deb 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py @@ -28,8 +28,6 @@ def sample_method_lro_signatures(): - """Snippet for method_lro_signatures""" - # Create a client client = mollusca_v1.SnippetsClient() 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 index 85cf60ef6c..36f286da93 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_method_one_signature(): - """Snippet for method_one_signature""" - # Create a client client = mollusca_v1.SnippetsAsyncClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py index d09678e58a..fad4a7d795 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py @@ -28,8 +28,6 @@ def sample_method_one_signature(): - """Snippet for method_one_signature""" - # Create a client client = mollusca_v1.SnippetsClient() 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 index 5dfc1b09ba..4a397d7985 100644 --- 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 @@ -28,8 +28,6 @@ async def sample_method_server_streaming(): - """Snippet for method_server_streaming""" - # Create a client client = mollusca_v1.SnippetsAsyncClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py index 92782bcad3..1701a3abc2 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py @@ -28,8 +28,6 @@ def sample_method_server_streaming(): - """Snippet for method_server_streaming""" - # Create a client client = mollusca_v1.SnippetsClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_async.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_async.py index 2bc72ff6d2..4a6d9f6827 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_async.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_async.py @@ -28,8 +28,6 @@ async def sample_one_of_method(): - """Snippet for one_of_method""" - # Create a client client = mollusca_v1.SnippetsAsyncClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_async.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_async.py index 4f074994b7..92a5bef4b4 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_async.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_async.py @@ -28,8 +28,6 @@ async def sample_one_of_method_required_field(): - """Snippet for one_of_method_required_field""" - # Create a client client = mollusca_v1.SnippetsAsyncClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_sync.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_sync.py index 6e480d5000..3a3c4818c3 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_sync.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_sync.py @@ -28,8 +28,6 @@ def sample_one_of_method_required_field(): - """Snippet for one_of_method_required_field""" - # Create a client client = mollusca_v1.SnippetsClient() diff --git a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_sync.py b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_sync.py index ce2a728843..7372dfbd76 100644 --- a/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_sync.py +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_sync.py @@ -28,8 +28,6 @@ def sample_one_of_method(): - """Snippet for one_of_method""" - # Create a client client = mollusca_v1.SnippetsClient() diff --git a/tests/snippetgen/goldens/snippet_metadata_v1_mollusca_v1.json b/tests/snippetgen/goldens/snippet_metadata_v1_mollusca_v1.json new file mode 100644 index 0000000000..c5badb1099 --- /dev/null +++ b/tests/snippetgen/goldens/snippet_metadata_v1_mollusca_v1.json @@ -0,0 +1,611 @@ +{ + "snippets": [ + { + "clientMethod": { + "method": { + "fullName": "MethodServerStreaming", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_server_streaming_sync.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_sync", + "segment": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "fullName": "OneOfMethodRequiredField", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_sync.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_OneOfMethodRequiredField_sync", + "segment": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "fullName": "OneOfMethod", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_one_of_method_sync.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_OneOfMethod_sync", + "segment": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "fullName": "MethodBidiStreaming", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_sync.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_sync", + "segment": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "fullName": "ListResources", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_list_resources_sync.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_ListResources_sync", + "segment": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "fullName": "MethodOneSignature", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_one_signature_sync.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_sync", + "segment": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "fullName": "MethodLroSignatures", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_sync.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_sync", + "segment": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "fullName": "MethodBidiStreaming", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_bidi_streaming_async.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodBidiStreaming_async", + "segment": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "fullName": "ListResources", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_list_resources_async.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_ListResources_async", + "segment": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "fullName": "OneOfMethodRequiredField", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_one_of_method_required_field_async.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_OneOfMethodRequiredField_async", + "segment": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "fullName": "MethodServerStreaming", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_server_streaming_async.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodServerStreaming_async", + "segment": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "fullName": "OneOfMethod", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_one_of_method_async.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_OneOfMethod_async", + "segment": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "fullName": "MethodOneSignature", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_one_signature_async.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodOneSignature_async", + "segment": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "fullName": "MethodLroSignatures", + "service": { + "shortName": "Snippets" + } + } + }, + "file": "samples/generated_samples/mollusca_generated_mollusca_v1_snippets_method_lro_signatures_async.py", + "regionTag": "mollusca_generated_mollusca_v1_Snippets_MethodLroSignatures_async", + "segment": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/samplegen/common_types.py b/tests/unit/common_types.py similarity index 100% rename from tests/unit/samplegen/common_types.py rename to tests/unit/common_types.py diff --git a/tests/unit/generator/__init__.py b/tests/unit/generator/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/generator/test_generator.py b/tests/unit/generator/test_generator.py index 62a12df90c..ebf0367194 100644 --- a/tests/unit/generator/test_generator.py +++ b/tests/unit/generator/test_generator.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json from textwrap import dedent from typing import Mapping from unittest import mock @@ -24,13 +25,25 @@ from google.protobuf.compiler.plugin_pb2 import CodeGeneratorResponse from gapic.generator import generator -from gapic.samplegen_utils import types, yaml +from gapic.samplegen_utils import snippet_metadata_pb2, types, yaml +from ..common_types import (DummyApiSchema, DummyField, DummyIdent, DummyNaming, DummyMessage, DummyMessageTypePB, + DummyService, DummyMethod, message_factory, enum_factory) + from gapic.schema import api from gapic.schema import naming from gapic.schema import wrappers from gapic.utils import Options +def mock_generate_sample(*args, **kwargs): + dummy_snippet_metadata = snippet_metadata_pb2.Snippet() + dummy_snippet_metadata.client_method.method.service.short_name = args[0]["service"].split( + ".")[-1] + dummy_snippet_metadata.client_method.method.short_name = args[0]['rpc'] + + return "", dummy_snippet_metadata + + def test_custom_template_directory(): # Create a generator. opts = Options.build("python-gapic-templates=/templates/") @@ -51,8 +64,8 @@ def test_get_response(): lt.assert_called_once() gt.assert_has_calls( [ - mock.call("foo/bar/baz.py.j2"), mock.call("molluscs/squid/sample.py.j2"), + mock.call("foo/bar/baz.py.j2"), ] ) assert len(cgr.file) == 1 @@ -71,8 +84,8 @@ def test_get_response_ignores_empty_files(): lt.assert_called_once() gt.assert_has_calls( [ - mock.call("foo/bar/baz.py.j2"), mock.call("molluscs/squid/sample.py.j2"), + mock.call("foo/bar/baz.py.j2"), ] ) assert len(cgr.file) == 0 @@ -93,8 +106,8 @@ def test_get_response_ignores_private_files(): lt.assert_called_once() gt.assert_has_calls( [ - mock.call("foo/bar/baz.py.j2"), mock.call("molluscs/squid/sample.py.j2"), + mock.call("foo/bar/baz.py.j2"), ] ) assert len(cgr.file) == 1 @@ -107,7 +120,6 @@ def test_get_response_fails_invalid_file_paths(): with mock.patch.object(jinja2.FileSystemLoader, "list_templates") as lt: lt.return_value = [ "foo/bar/%service/%proto/baz.py.j2", - "molluscs/squid/sample.py.j2", ] with pytest.raises(ValueError) as ex: g.get_response(api_schema=make_api(), @@ -403,13 +415,8 @@ def test_parse_sample_paths(fs): Options.build("samples=sampledir/,") -@mock.patch( - "gapic.samplegen.samplegen.generate_sample", return_value="", -) @mock.patch("time.gmtime",) -def test_samplegen_config_to_output_files( - mock_gmtime, mock_generate_sample, fs, -): +def test_samplegen_config_to_output_files(mock_gmtime, fs): # These time values are nothing special, # they just need to be deterministic. returner = mock.MagicMock() @@ -431,9 +438,11 @@ def test_samplegen_config_to_output_files( samples: - id: squid_sample region_tag: humboldt_tag - rpc: get_squid_streaming + service: Mollusc.v1.Mollusc + rpc: GetSquidStreaming - region_tag: clam_sample - rpc: get_clam + service: Mollusc.v1.Mollusc + rpc: GetClam """ ), ) @@ -442,57 +451,84 @@ def test_samplegen_config_to_output_files( # Need to have the sample template visible to the generator. g._env.loader = jinja2.DictLoader({"sample.py.j2": ""}) - api_schema = make_api(naming=naming.NewNaming( - name="Mollusc", version="v6")) - actual_response = g.get_response( - api_schema, opts=Options.build("")) - expected_response = CodeGeneratorResponse( - file=[ - CodeGeneratorResponse.File( - name="samples/generated_samples/squid_sample.py", content="\n",), - CodeGeneratorResponse.File( - name="samples/generated_samples/clam_sample.py", content="\n",), - # TODO(busunkim): Re-enable manifest generation once metadata - # format has been formalized. - # https://docs.google.com/document/d/1ghBam8vMj3xdoe4xfXhzVcOAIwrkbTpkMLgKc9RPD9k/edit#heading=h.sakzausv6hue - # CodeGeneratorResponse.File( - # name="samples/generated_samples/mollusc.v6.python.21120601.131313.manifest.yaml", - # content=dedent( - # """\ - # --- - # type: manifest/samples - # schema_version: 3 - # python: &python - # environment: python - # bin: python3 - # base_path: samples - # invocation: '{bin} {path} @args' - # samples: - # - <<: *python - # sample: squid_sample - # path: '{base_path}/squid_sample.py' - # region_tag: humboldt_tag - # - <<: *python - # sample: clam_sample - # path: '{base_path}/clam_sample.py' - # region_tag: clam_sample - # """ - # ), - # ), - ] - ) - expected_response.supported_features |= ( - CodeGeneratorResponse.Feature.FEATURE_PROTO3_OPTIONAL + api_schema = DummyApiSchema( + services={"Mollusc": DummyService( + name="Mollusc", + methods={ + # For this test the generator only cares about the dictionary keys + "GetSquidStreaming": DummyMethod(), + "GetClam": DummyMethod(), + }, + )}, + naming=DummyNaming(name="mollusc", version="v1", warehouse_package_name="mollusc-cephalopod-teuthida-", + versioned_module_name="teuthida_v1", module_namespace="mollusc.cephalopod"), ) - assert actual_response == expected_response + with mock.patch("gapic.samplegen.samplegen.generate_sample", side_effect=mock_generate_sample): + actual_response = g.get_response( + api_schema, opts=Options.build("")) + + expected_snippet_index_json = { + "snippets": [ + { + "clientMethod": { + "method": { + "shortName": "GetSquidStreaming", + "service": { + "shortName": "Mollusc" + } + } + }, + "file": "squid_sample.py", + "segments": [ + {"type": "FULL"}, + {"type": "SHORT"}, + {"type": "CLIENT_INITIALIZATION"}, + {"type": "REQUEST_INITIALIZATION"}, + {"type": "REQUEST_EXECUTION"}, + {"type": "RESPONSE_HANDLING"} + ] + }, + { + "clientMethod": { + "method": { + "shortName": "GetClam", + "service": { + "shortName": "Mollusc" + } + } + }, + "file": "clam_sample.py", + "segments": [ + {"type": "FULL"}, + {"type": "SHORT"}, + {"type": "CLIENT_INITIALIZATION"}, + {"type": "REQUEST_INITIALIZATION"}, + {"type": "REQUEST_EXECUTION"}, + {"type": "RESPONSE_HANDLING"} + ] + } + ] + } + + assert actual_response.supported_features == CodeGeneratorResponse.Feature.FEATURE_PROTO3_OPTIONAL + + assert len(actual_response.file) == 3 + assert actual_response.file[0] == CodeGeneratorResponse.File( + name="samples/generated_samples/squid_sample.py", content="\n",) + assert actual_response.file[1] == CodeGeneratorResponse.File( + name="samples/generated_samples/clam_sample.py", content="\n",) + + assert actual_response.file[2].name == "samples/generated_samples/snippet_metadata_mollusc_v1.json" + assert json.loads( + actual_response.file[2].content) == expected_snippet_index_json @mock.patch( "gapic.samplegen.samplegen.generate_sample_specs", return_value=[] ) @mock.patch( - "gapic.samplegen.samplegen.generate_sample", return_value="", + "gapic.samplegen.samplegen.generate_sample", return_value=("", snippet_metadata_pb2.Snippet()), ) def test_generate_autogen_samples(mock_generate_sample, mock_generate_specs): opts = Options.build("autogen-snippets") @@ -513,11 +549,8 @@ def test_generate_autogen_samples(mock_generate_sample, mock_generate_specs): ) -@mock.patch( - "gapic.samplegen.samplegen.generate_sample", return_value="", -) @mock.patch("time.gmtime",) -def test_samplegen_id_disambiguation(mock_gmtime, mock_generate_sample, fs): +def test_samplegen_id_disambiguation(mock_gmtime, fs): # These time values are nothing special, # they just need to be deterministic. returner = mock.MagicMock() @@ -543,12 +576,15 @@ def test_samplegen_id_disambiguation(mock_gmtime, mock_generate_sample, fs): samples: - id: squid_sample region_tag: humboldt_tag - rpc: get_squid_streaming + rpc: GetSquidStreaming + service: Mollusc.v1.Mollusc # Note that this region tag collides with the id of the previous sample. - region_tag: squid_sample - rpc: get_squid_streaming + rpc: GetSquidStreaming + service: Mollusc.v1.Mollusc # No id or region tag. - - rpc: get_squid_streaming + - rpc: GetSquidStreaming + service: Mollusc.v1.Mollusc """ ), ) @@ -556,57 +592,98 @@ def test_samplegen_id_disambiguation(mock_gmtime, mock_generate_sample, fs): # Need to have the sample template visible to the generator. g._env.loader = jinja2.DictLoader({"sample.py.j2": ""}) - api_schema = make_api(naming=naming.NewNaming( - name="Mollusc", version="v6")) - actual_response = g.get_response(api_schema, + api_schema = DummyApiSchema( + services={"Mollusc": DummyService( + name="Mollusc", + methods={ + # The generator only cares about the dictionary keys + "GetSquidStreaming": DummyMethod(), + "GetClam": DummyMethod(), + }, + )}, + naming=DummyNaming(name="mollusc", version="v1", warehouse_package_name="mollusc-cephalopod-teuthida-", + versioned_module_name="teuthida_v1", module_namespace="mollusc.cephalopod"), + ) + with mock.patch("gapic.samplegen.samplegen.generate_sample", side_effect=mock_generate_sample): + actual_response = g.get_response(api_schema, opts=Options.build("")) - expected_response = CodeGeneratorResponse( - file=[ - CodeGeneratorResponse.File( - name="samples/generated_samples/squid_sample_91a465c6.py", content="\n", - ), - CodeGeneratorResponse.File( - name="samples/generated_samples/squid_sample_55051b38.py", content="\n", - ), - CodeGeneratorResponse.File(name="samples/generated_samples/157884ee.py", - content="\n",), - # TODO(busunkim): Re-enable manifest generation once metadata - # format has been formalized. - # https://docs.google.com/document/d/1ghBam8vMj3xdoe4xfXhzVcOAIwrkbTpkMLgKc9RPD9k/edit#heading=h.sakzausv6hue - # CodeGeneratorResponse.File( - # name="samples/generated_samples/mollusc.v6.python.21120601.131313.manifest.yaml", - # content=dedent( - # """\ - # --- - # type: manifest/samples - # schema_version: 3 - # python: &python - # environment: python - # bin: python3 - # base_path: samples - # invocation: '{bin} {path} @args' - # samples: - # - <<: *python - # sample: squid_sample_91a465c6 - # path: '{base_path}/squid_sample_91a465c6.py' - # region_tag: humboldt_tag - # - <<: *python - # sample: squid_sample_55051b38 - # path: '{base_path}/squid_sample_55051b38.py' - # region_tag: squid_sample - # - <<: *python - # sample: 157884ee - # path: '{base_path}/157884ee.py' - # """ - # ), - # ), - ] + + expected_snippet_metadata_json = { + "snippets": [ + { + "clientMethod": { + "method": { + "shortName": "GetSquidStreaming", + "service": { + "shortName": "Mollusc" + } + } + }, + "file": "squid_sample_1cfd0b3d.py", + "segments": [ + {"type": "FULL"}, + {"type": "SHORT"}, + {"type": "CLIENT_INITIALIZATION"}, + {"type": "REQUEST_INITIALIZATION"}, + {"type": "REQUEST_EXECUTION"}, + {"type": "RESPONSE_HANDLING"} + ] + }, + { + "clientMethod": { + "method": { + "shortName": "GetSquidStreaming", + "service": { + "shortName": "Mollusc" + } + } + }, + "file": "squid_sample_cf4d4fa4.py", + "segments": [ + {"type": "FULL"}, + {"type": "SHORT"}, + {"type": "CLIENT_INITIALIZATION"}, + {"type": "REQUEST_INITIALIZATION"}, + {"type": "REQUEST_EXECUTION"}, + {"type": "RESPONSE_HANDLING"} + ] + }, + { + "clientMethod": { + "method": { + "shortName": "GetSquidStreaming", + "service": { + "shortName": "Mollusc" + } + } + }, + "file": "7384949e.py", + "segments": [ + {"type": "FULL"}, + {"type": "SHORT"}, + {"type": "CLIENT_INITIALIZATION"}, + {"type": "REQUEST_INITIALIZATION"}, + {"type": "REQUEST_EXECUTION"}, + {"type": "RESPONSE_HANDLING"} + ] + } + ] + } + + assert actual_response.supported_features == CodeGeneratorResponse.Feature.FEATURE_PROTO3_OPTIONAL + assert len(actual_response.file) == 4 + assert actual_response.file[0] == CodeGeneratorResponse.File( + name="samples/generated_samples/squid_sample_1cfd0b3d.py", content="\n", ) - expected_response.supported_features |= ( - CodeGeneratorResponse.Feature.FEATURE_PROTO3_OPTIONAL + assert actual_response.file[1] == CodeGeneratorResponse.File( + name="samples/generated_samples/squid_sample_cf4d4fa4.py", content="\n", ) - - assert actual_response == expected_response + assert actual_response.file[2] == CodeGeneratorResponse.File( + name="samples/generated_samples/7384949e.py", content="\n", + ) + assert actual_response.file[3].name == "samples/generated_samples/snippet_metadata_mollusc_v1.json" + assert json.loads( + actual_response.file[3].content) == expected_snippet_metadata_json def test_generator_duplicate_samples(fs): @@ -639,116 +716,6 @@ def test_generator_duplicate_samples(fs): opts=Options.build("")) -@mock.patch("gapic.samplegen.samplegen.generate_sample", return_value="") -@mock.patch("time.gmtime",) -def test_dont_generate_in_code_samples(mock_gmtime, mock_generate_sample, fs): - # These time values are nothing special, - # they just need to be deterministic. - returner = mock.MagicMock() - returner.tm_year = 2112 - returner.tm_mon = 6 - returner.tm_mday = 1 - returner.tm_hour = 13 - returner.tm_min = 13 - returner.tm_sec = 13 - mock_gmtime.return_value = returner - - config_fpath = "samples.yaml" - fs.create_file( - config_fpath, - contents=dedent( - """ - type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto - schema_version: 1.2.0 - samples: - - id: squid_sample - rpc: IdentifyMollusc - service: Mollusc.v1.Mollusc - sample_type: - - standalone - - incode/SQUID - - id: clam_sample - rpc: IdentifyMollusc - service: Mollusc.v1.Mollusc - sample_type: - - incode/CLAM - - id: whelk_sample - rpc: IdentifyMollusc - service: Mollusc.v1.Mollusc - sample_type: - - standalone - - id: octopus_sample - rpc: IdentifyMollusc - service: Mollusc.v1.Mollusc - """ - ), - ) - - generator = make_generator(f"samples={config_fpath}") - generator._env.loader = jinja2.DictLoader({"sample.py.j2": ""}) - api_schema = make_api( - make_proto( - descriptor_pb2.FileDescriptorProto( - name="mollusc.proto", - package="Mollusc.v1", - service=[descriptor_pb2.ServiceDescriptorProto( - name="Mollusc")], - ), - ), - naming=naming.NewNaming(name="Mollusc", version="v6"), - ) - - # Note that we do NOT expect a clam sample. - # There are four tests going on: - # 1) Just an explicit standalone sample type. - # 2) Multiple sample types, one of which is standalone. - # 3) Explicit sample types but NO standalone sample type. - # 4) Implicit standalone sample type. - expected = CodeGeneratorResponse( - file=[ - CodeGeneratorResponse.File( - name="samples/generated_samples/squid_sample.py", content="\n",), - CodeGeneratorResponse.File( - name="samples/generated_samples/whelk_sample.py", content="\n",), - CodeGeneratorResponse.File( - name="samples/generated_samples/octopus_sample.py", content="\n",), - # TODO(busunkim): Re-enable manifest generation once metadata - # format has been formalized. - # https://docs.google.com/document/d/1ghBam8vMj3xdoe4xfXhzVcOAIwrkbTpkMLgKc9RPD9k/edit#heading=h.sakzausv6hue - # CodeGeneratorResponse.File( - # name="samples/generated_samples/mollusc.v6.python.21120601.131313.manifest.yaml", - # content=dedent( - # """ --- - # type: manifest/samples - # schema_version: 3 - # python: &python - # environment: python - # bin: python3 - # base_path: samples - # invocation: \'{bin} {path} @args\' - # samples: - # - <<: *python - # sample: squid_sample - # path: \'{base_path}/squid_sample.py\' - # - <<: *python - # sample: whelk_sample - # path: \'{base_path}/whelk_sample.py\' - # - <<: *python - # sample: octopus_sample - # path: \'{base_path}/octopus_sample.py\' - # """ - # ), - # ), - ] - ) - expected.supported_features |= CodeGeneratorResponse.Feature.FEATURE_PROTO3_OPTIONAL - - actual = generator.get_response( - api_schema=api_schema, opts=Options.build("") - ) - assert actual == expected - - def make_generator(opts_str: str = "") -> generator.Generator: return generator.Generator(Options.build(opts_str)) diff --git a/tests/unit/samplegen/__init__.py b/tests/unit/samplegen/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/samplegen/golden_snippets/sample_basic.py b/tests/unit/samplegen/golden_snippets/sample_basic.py index c6c44239c8..76b0b58bff 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic.py @@ -28,8 +28,6 @@ def sample_classify(video, location): - """Determine the full taxonomy of input mollusc""" - # Create a client client = molluscclient.MolluscServiceClient() diff --git a/tests/unit/samplegen/golden_snippets/sample_basic_async.py b/tests/unit/samplegen/golden_snippets/sample_basic_async.py index 8ad414a78f..71a6d3853c 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic_async.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic_async.py @@ -28,8 +28,6 @@ async def sample_classify(video, location): - """Determine the full taxonomy of input mollusc""" - # Create a client client = molluscclient.MolluscServiceAsyncClient() diff --git a/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py b/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py index c6c44239c8..76b0b58bff 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py @@ -28,8 +28,6 @@ def sample_classify(video, location): - """Determine the full taxonomy of input mollusc""" - # Create a client client = molluscclient.MolluscServiceClient() diff --git a/tests/unit/samplegen/golden_snippets/sample_basic_void_method.py b/tests/unit/samplegen/golden_snippets/sample_basic_void_method.py index a6e7d48b6e..0b617f40ed 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic_void_method.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic_void_method.py @@ -28,8 +28,6 @@ def sample_classify(video, location): - """Determine the full taxonomy of input mollusc""" - # Create a client client = molluscclient.MolluscServiceClient() diff --git a/tests/unit/samplegen/test_integration.py b/tests/unit/samplegen/test_integration.py index aefde2f1dc..b1b439549e 100644 --- a/tests/unit/samplegen/test_integration.py +++ b/tests/unit/samplegen/test_integration.py @@ -17,13 +17,16 @@ import pytest from pathlib import Path +from google.protobuf import json_format + import gapic.utils as utils from gapic.samplegen import samplegen from gapic.samplegen_utils import (types, utils as gapic_utils) +from gapic.samplegen_utils import snippet_metadata_pb2 from gapic.schema import (naming, wrappers) -from common_types import (DummyField, DummyMessage, +from ..common_types import (DummyField, DummyMessage, DummyMessageTypePB, DummyMethod, DummyService, DummyIdent, DummyApiSchema, DummyNaming, enum_factory, message_factory) @@ -105,6 +108,7 @@ def test_generate_sample_basic(): ) sample = {"service": "animalia.mollusca.v1.Mollusc", + "region_tag": "molluscs_generated_molluscs_v1_Mollusc_Classify_sync", "rpc": "Classify", "id": "mollusc_classify_sync", "description": "Determine the full taxonomy of input mollusc", @@ -119,13 +123,21 @@ def test_generate_sample_basic(): ], "response": [{"print": ['Mollusc is a "%s"', "$resp.taxonomy"]}]} - sample_str = samplegen.generate_sample( + sample_str, metadata = samplegen.generate_sample( sample, schema, env.get_template('examples/sample.py.j2') ) assert sample_str == golden_snippet("sample_basic.py") + assert json_format.MessageToDict(metadata) == { + 'regionTag': 'molluscs_generated_molluscs_v1_Mollusc_Classify_sync', + 'clientMethod': + {'method': { + 'shortName': 'Classify', + 'service': {'shortName': 'Mollusc'} + }} + } def test_generate_sample_basic_async(): @@ -180,6 +192,7 @@ def test_generate_sample_basic_async(): ) sample = {"service": "animalia.mollusca.v1.Mollusc", + "region_tag": "molluscs_generated_molluscs_v1_Mollusc_Classify_async", "rpc": "Classify", "transport": "grpc-async", "id": "mollusc_classify_sync", @@ -195,13 +208,23 @@ def test_generate_sample_basic_async(): ], "response": [{"print": ['Mollusc is a "%s"', "$resp.taxonomy"]}]} - sample_str = samplegen.generate_sample( + sample_str, metadata = samplegen.generate_sample( sample, schema, env.get_template('examples/sample.py.j2') ) assert sample_str == golden_snippet("sample_basic_async.py") + assert json_format.MessageToDict(metadata) == { + 'regionTag': 'molluscs_generated_molluscs_v1_Mollusc_Classify_async', + 'clientMethod': + { + 'async': True, + 'method': { + 'shortName': 'Classify', + 'service': {'shortName': 'Mollusc'} + }} + } def test_generate_sample_basic_unflattenable(): @@ -251,6 +274,7 @@ def test_generate_sample_basic_unflattenable(): ) sample = {"service": "animalia.mollusca.v1.Mollusc", + "region_tag": "molluscs_generated_molluscs_v1_Mollusc_Classify_sync", "rpc": "Classify", "id": "mollusc_classify_sync", "description": "Determine the full taxonomy of input mollusc", @@ -265,13 +289,22 @@ def test_generate_sample_basic_unflattenable(): ], "response": [{"print": ['Mollusc is a "%s"', "$resp.taxonomy"]}]} - sample_str = samplegen.generate_sample( + sample_str, metadata = samplegen.generate_sample( sample, schema, env.get_template('examples/sample.py.j2') ) assert sample_str == golden_snippet("sample_basic_unflattenable.py") + assert json_format.MessageToDict(metadata) == { + 'regionTag': 'molluscs_generated_molluscs_v1_Mollusc_Classify_sync', + 'clientMethod': + { + 'method': { + 'shortName': 'Classify', + 'service': {'shortName': 'Mollusc'} + }} + } def test_generate_sample_void_method(): @@ -320,6 +353,7 @@ def test_generate_sample_void_method(): ) sample = {"service": "animalia.mollusca.v1.Mollusc", + "region_tag": "molluscs_generated_molluscs_v1_Mollusc_Classify_sync", "rpc": "Classify", "id": "mollusc_classify_sync", "description": "Determine the full taxonomy of input mollusc", @@ -333,13 +367,22 @@ def test_generate_sample_void_method(): "input_parameter": "location"} ]} - sample_str = samplegen.generate_sample( + sample_str, metadata = samplegen.generate_sample( sample, schema, env.get_template('examples/sample.py.j2') ) assert sample_str == golden_snippet("sample_basic_void_method.py") + assert json_format.MessageToDict(metadata) == { + 'regionTag': 'molluscs_generated_molluscs_v1_Mollusc_Classify_sync', + 'clientMethod': + { + 'method': { + 'shortName': 'Classify', + 'service': {'shortName': 'Mollusc'} + }} + } def test_generate_sample_service_not_found(): diff --git a/tests/unit/samplegen/test_manifest.py b/tests/unit/samplegen/test_manifest.py index d1eb23e787..5fe7217a30 100644 --- a/tests/unit/samplegen/test_manifest.py +++ b/tests/unit/samplegen/test_manifest.py @@ -19,7 +19,7 @@ import gapic.samplegen_utils.yaml as gapic_yaml import gapic.samplegen_utils.types as types import gapic.samplegen.manifest as manifest -from common_types import DummyApiSchema, DummyNaming +from ..common_types import DummyApiSchema, DummyNaming def test_generate_manifest(): diff --git a/tests/unit/samplegen/test_samplegen.py b/tests/unit/samplegen/test_samplegen.py index c42420be59..00608a2ae7 100644 --- a/tests/unit/samplegen/test_samplegen.py +++ b/tests/unit/samplegen/test_samplegen.py @@ -29,7 +29,7 @@ import gapic.schema.wrappers as wrappers from gapic.utils import Options -from common_types import (DummyApiSchema, DummyField, DummyIdent, DummyNaming, DummyMessage, DummyMessageTypePB, +from ..common_types import (DummyApiSchema, DummyField, DummyIdent, DummyNaming, DummyMessage, DummyMessageTypePB, DummyService, DummyMethod, message_factory, enum_factory) from gapic.samplegen_utils import utils @@ -2087,7 +2087,6 @@ def test_generate_sample_spec_basic(): assert len(specs) == 2 assert specs[0] == { - "sample_type": "standalone", "rpc": "Ramshorn", "transport": "grpc", "service": "animalia.mollusca.v1.Squid", @@ -2096,7 +2095,6 @@ def test_generate_sample_spec_basic(): } assert specs[1] == { - "sample_type": "standalone", "rpc": "Ramshorn", "transport": "grpc-async", "service": "animalia.mollusca.v1.Squid", diff --git a/tests/unit/samplegen/test_snippet_index.py b/tests/unit/samplegen/test_snippet_index.py index 09f782a099..8f9db94236 100644 --- a/tests/unit/samplegen/test_snippet_index.py +++ b/tests/unit/samplegen/test_snippet_index.py @@ -19,7 +19,7 @@ from gapic.samplegen_utils import snippet_metadata_pb2 from gapic.samplegen_utils import snippet_index, types -from common_types import DummyApiSchema, DummyService, DummyMethod +from ..common_types import DummyApiSchema, DummyService, DummyMethod @pytest.fixture @@ -82,7 +82,6 @@ def test_snippet_init(sample_str): # and # [END ...] lines expected_full_snipppet = """from molluscs.v1 import molluscclient - def sample_classify(video, location): # Create a client client = molluscclient.MolluscServiceClient() @@ -130,7 +129,7 @@ def test_add_snippet_no_matching_rpc(sample_str): snippet_metadata = snippet_metadata_pb2.Snippet( ) snippet_metadata.client_method.method.service.short_name = "Squid" - snippet_metadata.client_method.full_name = "classify" + snippet_metadata.client_method.short_name = "classify" snippet = snippet_index.Snippet(sample_str, snippet_metadata) # No 'classify' method in 'Squid' service @@ -166,7 +165,7 @@ def test_get_snippet_no_matching_rpc(): def test_add_and_get_snippet_sync(sample_str): snippet_metadata = snippet_metadata_pb2.Snippet() snippet_metadata.client_method.method.service.short_name = "Squid" - snippet_metadata.client_method.method.full_name = "classify" + snippet_metadata.client_method.method.short_name = "classify" snippet = snippet_index.Snippet(sample_str, snippet_metadata) index = snippet_index.SnippetIndex(api_schema=DummyApiSchema( @@ -182,7 +181,7 @@ def test_add_and_get_snippet_sync(sample_str): def test_add_and_get_snippet_async(sample_str): snippet_metadata = snippet_metadata_pb2.Snippet() snippet_metadata.client_method.method.service.short_name = "Squid" - snippet_metadata.client_method.method.full_name = "classify" + snippet_metadata.client_method.method.short_name = "classify" setattr(snippet_metadata.client_method, "async", True) snippet = snippet_index.Snippet(sample_str, snippet_metadata) @@ -199,7 +198,7 @@ def test_add_and_get_snippet_async(sample_str): def test_get_metadata_json(sample_str): snippet_metadata = snippet_metadata_pb2.Snippet() snippet_metadata.client_method.method.service.short_name = "Squid" - snippet_metadata.client_method.method.full_name = "classify" + snippet_metadata.client_method.method.short_name = "classify" snippet = snippet_index.Snippet(sample_str, snippet_metadata) index = snippet_index.SnippetIndex(api_schema=DummyApiSchema( @@ -210,7 +209,7 @@ def test_get_metadata_json(sample_str): index.add_snippet(snippet) assert json.loads(index.get_metadata_json()) == { - 'snippets': [{'clientMethod': {'method': {'fullName': 'classify', + 'snippets': [{'clientMethod': {'method': {'shortName': 'classify', 'service': {'shortName': 'Squid'}}}, 'segments': [{'end': 28, 'start': 2, 'type': 'FULL'}, {'end': 28, 'start': 2, 'type': 'SHORT'}, diff --git a/tests/unit/samplegen/test_template.py b/tests/unit/samplegen/test_template.py index 42b8bb2aad..15b59e5369 100644 --- a/tests/unit/samplegen/test_template.py +++ b/tests/unit/samplegen/test_template.py @@ -21,7 +21,7 @@ from gapic.samplegen_utils.types import CallingForm from textwrap import dedent -import common_types +from .. import common_types def check_template(template_fragment, expected_output, **kwargs):