diff --git a/gapic/samplegen/samplegen.py b/gapic/samplegen/samplegen.py index 876f0b9d0a..b19ce4fa87 100644 --- a/gapic/samplegen/samplegen.py +++ b/gapic/samplegen/samplegen.py @@ -202,7 +202,7 @@ def build( f"Resource {resource_typestr} has no pattern with params: {attr_name_str}" ) - return cls(base=base, body=attrs, single=None, pattern=pattern) + return cls(base=base, body=attrs, single=None, pattern=pattern,) @dataclasses.dataclass @@ -293,17 +293,22 @@ def preprocess_sample(sample, api_schema: api.API, rpc: wrappers.Method): sample["module_name"] = api_schema.naming.versioned_module_name sample["module_namespace"] = api_schema.naming.module_namespace + service = api_schema.services[sample["service"]] + # Assume the gRPC transport if the transport is not specified - sample.setdefault("transport", api.TRANSPORT_GRPC) + transport = sample.setdefault("transport", api.TRANSPORT_GRPC) - if sample["transport"] == api.TRANSPORT_GRPC_ASYNC: - sample["client_name"] = api_schema.services[sample["service"] - ].async_client_name - else: - sample["client_name"] = api_schema.services[sample["service"]].client_name + is_async = transport == api.TRANSPORT_GRPC_ASYNC + sample["client_name"] = service.async_client_name if is_async else service.client_name - # the type of the request object passed to the rpc e.g, `ListRequest` - sample["request_type"] = rpc.input.ident.name + # the MessageType of the request object passed to the rpc e.g, `ListRequest` + sample["request_type"] = rpc.input + + # If no request was specified in the config + # Add reasonable default values as placeholders + if "request" not in sample: + sample["request"] = generate_request_object( + api_schema, service, rpc.input) # If no response was specified in the config # Add reasonable defaults depending on the type of the sample @@ -940,6 +945,58 @@ def parse_handwritten_specs(sample_configs: Sequence[str]) -> Generator[Dict[str yield spec +def generate_request_object(api_schema: api.API, service: wrappers.Service, message: wrappers.MessageType, field_name_prefix: str = ""): + """Generate dummy input for a given message. + + Args: + api_schema (api.API): The schema that defines the API. + service (wrappers.Service): The service object the message belongs to. + message (wrappers.MessageType): The message to generate a request object for. + field_name_prefix (str): A prefix to attach to the field name in the request. + + Returns: + List[Dict[str, Any]]: A list of dicts that can be turned into TransformedRequests. + """ + request: List[Dict[str, Any]] = [] + + request_fields: List[wrappers.Field] = [] + + # Choose the first option for each oneof + selected_oneofs: List[wrappers.Field] = [oneof_fields[0] + for oneof_fields in message.oneof_fields().values()] + request_fields = selected_oneofs + message.required_fields + + for field in request_fields: + # TransformedRequest expects nested fields to be referenced like + # `destination.input_config.name` + field_name = ".".join([field_name_prefix, field.name]).lstrip('.') + + # TODO(busunkim): Properly handle map fields + if field.is_primitive: + placeholder_value = field.mock_value_original_type + # If this field identifies a resource use the resource path + if service.resource_messages_dict.get(field.resource_reference): + placeholder_value = service.resource_messages_dict[ + field.resource_reference].resource_path + request.append({"field": field_name, "value": placeholder_value}) + elif field.enum: + # Choose the last enum value in the list since index 0 is often "unspecified" + request.append( + {"field": field_name, "value": field.enum.values[-1].name}) + else: + # This is a message type, recurse + # TODO(busunkim): Some real world APIs have + # request objects are recursive. + # Reference `Field.mock_value` to ensure + # this always terminates. + request += generate_request_object( + api_schema, service, field.type, + field_name_prefix=field_name, + ) + + return request + + def generate_sample_specs(api_schema: api.API, *, opts) -> Generator[Dict[str, Any], None, None]: """Given an API, generate basic sample specs for each method. @@ -964,8 +1021,7 @@ def generate_sample_specs(api_schema: api.API, *, opts) -> Generator[Dict[str, A "sample_type": "standalone", "rpc": rpc_name, "transport": transport, - "request": [], - # response is populated in `preprocess_sample` + # `request` and `response` is populated in `preprocess_sample` "service": f"{api_schema.naming.proto_package}.{service_name}", "region_tag": region_tag, "description": f"Snippet for {utils.to_snake_case(rpc_name)}" diff --git a/gapic/schema/wrappers.py b/gapic/schema/wrappers.py index 0e59458921..8c2313f8a7 100644 --- a/gapic/schema/wrappers.py +++ b/gapic/schema/wrappers.py @@ -31,7 +31,7 @@ import dataclasses import re from itertools import chain -from typing import (cast, Dict, FrozenSet, Iterable, List, Mapping, +from typing import (Any, cast, Dict, FrozenSet, Iterable, List, Mapping, ClassVar, Optional, Sequence, Set, Tuple, Union) from google.api import annotations_pb2 # type: ignore from google.api import client_pb2 @@ -89,6 +89,17 @@ def map(self) -> bool: """Return True if this field is a map, False otherwise.""" return bool(self.repeated and self.message and self.message.map) + @utils.cached_property + def mock_value_original_type(self) -> Union[bool, str, bytes, int, float, List[Any], None]: + answer = self.primitive_mock() or None + + # If this is a repeated field, then the mock answer should + # be a list. + if self.repeated: + answer = [answer] + + return answer + @utils.cached_property def mock_value(self) -> str: visited_fields: Set["Field"] = set() @@ -100,25 +111,13 @@ def mock_value(self) -> str: return answer - def inner_mock(self, stack, visited_fields): + def inner_mock(self, stack, visited_fields) -> str: """Return a repr of a valid, usually truthy mock value.""" # For primitives, send a truthy value computed from the # field name. answer = 'None' if isinstance(self.type, PrimitiveType): - if self.type.python_type == bool: - answer = 'True' - elif self.type.python_type == str: - answer = f"'{self.name}_value'" - elif self.type.python_type == bytes: - answer = f"b'{self.name}_blob'" - elif self.type.python_type == int: - answer = f'{sum([ord(i) for i in self.name])}' - elif self.type.python_type == float: - answer = f'0.{sum([ord(i) for i in self.name])}' - else: # Impossible; skip coverage checks. - raise TypeError('Unrecognized PrimitiveType. This should ' - 'never happen; please file an issue.') + answer = self.primitive_mock_as_str() # If this is an enum, select the first truthy value (or the zero # value if nothing else exists). @@ -158,6 +157,45 @@ def inner_mock(self, stack, visited_fields): # Done; return the mock value. return answer + def primitive_mock(self) -> Union[bool, str, bytes, int, float, List[Any], None]: + """Generate a valid mock for a primitive type. This function + returns the original (Python) type. + """ + answer: Union[bool, str, bytes, int, float, List[Any], None] = None + + if not isinstance(self.type, PrimitiveType): + raise TypeError(f"'inner_mock_as_original_type' can only be used for" + f"PrimitiveType, but type is {self.type}") + + else: + if self.type.python_type == bool: + answer = True + elif self.type.python_type == str: + answer = f"{self.name}_value" + elif self.type.python_type == bytes: + answer = bytes(f"{self.name}_blob", encoding="utf-8") + elif self.type.python_type == int: + answer = sum([ord(i) for i in self.name]) + elif self.type.python_type == float: + name_sum = sum([ord(i) for i in self.name]) + answer = name_sum * pow(10, -1 * len(str(name_sum))) + else: # Impossible; skip coverage checks. + raise TypeError('Unrecognized PrimitiveType. This should ' + 'never happen; please file an issue.') + + return answer + + def primitive_mock_as_str(self) -> str: + """Like primitive mock, but return the mock as a string.""" + answer = self.primitive_mock() + + if isinstance(answer, str): + answer = f"'{answer}'" + else: + answer = str(answer) + + return answer + @property def proto_type(self) -> str: """Return the proto type constant to be used in templates.""" @@ -186,6 +224,17 @@ def required(self) -> bool: return (field_behavior_pb2.FieldBehavior.Value('REQUIRED') in self.options.Extensions[field_behavior_pb2.field_behavior]) + @property + def resource_reference(self) -> Optional[str]: + """Return a resource reference type if it exists. + + This is only applicable for string fields. + Example: "translate.googleapis.com/Glossary" + """ + return (self.options.Extensions[resource_pb2.resource_reference].type + or self.options.Extensions[resource_pb2.resource_reference].child_type + or None) + @utils.cached_property def type(self) -> Union['MessageType', 'EnumType', 'PrimitiveType']: """Return the type of this field.""" @@ -286,6 +335,13 @@ def oneof_fields(self, include_optional=False): return oneof_fields + @utils.cached_property + def required_fields(self) -> Sequence['Field']: + required_fields = [ + field for field in self.fields.values() if field.required] + + return required_fields + @utils.cached_property def field_types(self) -> Sequence[Union['MessageType', 'EnumType']]: answer = tuple( @@ -353,6 +409,11 @@ def resource_type(self) -> Optional[str]: resource = self.options.Extensions[resource_pb2.resource] return resource.type[resource.type.find('/') + 1:] if resource else None + @property + def resource_type_full_path(self) -> Optional[str]: + resource = self.options.Extensions[resource_pb2.resource] + return resource.type if resource else None + @property def resource_path_args(self) -> Sequence[str]: return self.PATH_ARG_RE.findall(self.resource_path or '') @@ -1199,6 +1260,27 @@ def gen_indirect_resources_used(message): ) ) + @utils.cached_property + def resource_messages_dict(self) -> Dict[str, MessageType]: + """Returns a dict from resource reference to + the message type. This *includes* the common resource messages. + + Returns: + Dict[str, MessageType]: A mapping from resource path + string to the corresponding MessageType. + `{"locations.googleapis.com/Location": MessageType(...)}` + """ + service_resource_messages = { + r.resource_type_full_path: r for r in self.resource_messages} + + # Add common resources + service_resource_messages.update( + (resource_path, resource.message_type) + for resource_path, resource in self.common_resources.items() + ) + + return service_resource_messages + @utils.cached_property def any_client_streaming(self) -> bool: return any(m.client_streaming for m in self.methods.values()) diff --git a/gapic/templates/examples/feature_fragments.j2 b/gapic/templates/examples/feature_fragments.j2 index 502d68fa60..eda14df7e4 100644 --- a/gapic/templates/examples/feature_fragments.j2 +++ b/gapic/templates/examples/feature_fragments.j2 @@ -126,18 +126,19 @@ with open({{ print_string_formatting(statement["filename"])|trim }}, "wb") as f: {% macro render_request_attr(base_name, attr) %} {# Note: python code will have manipulated the value #} {# to be the correct enum from the right module, if necessary. #} -{# Python is also responsible for verifying that each input parameter is unique,#} +{# Python is also responsible for verifying that each input parameter is unique, #} {# no parameter is a reserved keyword #} {% if attr.input_parameter %} + # {{ attr.input_parameter }} = {{ attr.value }} {% if attr.value_is_file %} with open({{ attr.input_parameter }}, "rb") as f: - {{ base_name }}["{{ attr.field }}"] = f.read() + {{ base_name }}.{{ attr.field }} = f.read() {% else %} -{{ base_name }}["{{ attr.field }}"] = {{ attr.input_parameter }} +{{ base_name }}.{{ attr.field }} = {{ attr.input_parameter }} {% endif %} {% else %} -{{ base_name }}["{{ attr.field }}"] = {{ attr.value }} +{{ base_name }}.{{ attr.field }} = {{ attr.value }} {% endif %} {% endmacro %} @@ -159,16 +160,17 @@ client = {{ module_name }}.{{ client_name }}() {{ parameter_block.base }} = "{{parameter_block.pattern }}".format({{ formals|join(", ") }}) {% endwith %} {% else %}{# End resource name construction #} -{{ parameter_block.base }} = {} +{{ parameter_block.base }} = {{ module_name }}.{{ request_type.get_field(parameter_block.base).type.name }}() {% for attr in parameter_block.body %} -{{ render_request_attr(parameter_block.base, attr) }} +{{ render_request_attr(parameter_block.base, attr) -}} {% endfor %} + {% endif %} {% endfor %} {% if not full_request.flattenable %} -request = {{ module_name }}.{{ request_type }}( +request = {{ module_name }}.{{ request_type.ident.name }}( {% for parameter in full_request.request_list %} - {{ parameter.base }}={{ parameter.base if parameter.body else parameter.single }}, + {{ parameter.base }}={{ parameter.base if parameter.body else parameter.single.value }}, {% endfor %} ) {% endif %} diff --git a/noxfile.py b/noxfile.py index 5296514a68..e270f0423e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -50,7 +50,7 @@ def unit(session): "--cov-report=term", "--cov-fail-under=100", path.join("tests", "unit"), - ] + ] ), ) @@ -308,7 +308,7 @@ def snippetgen(session): session.run( "py.test", - "--quiet", + "-vv", "tests/snippetgen" ) 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 e5c7daddc0..633f8b0467 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 @@ -34,7 +34,11 @@ async def sample_analyze_iam_policy(): client = asset_v1.AssetServiceAsyncClient() # 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 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 81abec2403..f3a40e1568 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 @@ -34,7 +34,15 @@ async def sample_analyze_iam_policy_longrunning(): client = asset_v1.AssetServiceAsyncClient() # 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 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 c59ff3936a..6bfec27de9 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 @@ -34,7 +34,15 @@ def sample_analyze_iam_policy_longrunning(): 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 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 188cc12bca..22017d9960 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 @@ -34,7 +34,11 @@ def sample_analyze_iam_policy(): 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 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 29da9244a8..f2f051da59 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 @@ -35,6 +35,7 @@ async def sample_batch_get_assets_history(): # Initialize request argument(s) request = asset_v1.BatchGetAssetsHistoryRequest( + parent="*", ) # Make the request 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 8fd8b83c10..ed2d78e9e6 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 @@ -35,6 +35,7 @@ def sample_batch_get_assets_history(): # Initialize request argument(s) request = asset_v1.BatchGetAssetsHistoryRequest( + parent="*", ) # Make the request 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 e6a4c3b8dd..eb42919714 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 @@ -34,7 +34,13 @@ async def sample_create_feed(): client = asset_v1.AssetServiceAsyncClient() # 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 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 c41f2d9289..c5a31c080d 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 @@ -34,7 +34,13 @@ def sample_create_feed(): 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 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 8e10aedf8d..793a1d28ac 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 @@ -35,6 +35,7 @@ async def sample_delete_feed(): # Initialize request argument(s) request = asset_v1.DeleteFeedRequest( + name="projects/{project}/feeds/{feed}", ) # Make the request 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 6f28f8c5de..f12a42bd1e 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 @@ -35,6 +35,7 @@ def sample_delete_feed(): # Initialize request argument(s) request = asset_v1.DeleteFeedRequest( + name="projects/{project}/feeds/{feed}", ) # Make the request 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 776264c0dd..00c75331d9 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 @@ -34,7 +34,12 @@ async def sample_export_assets(): client = asset_v1.AssetServiceAsyncClient() # Initialize request argument(s) + output_config = asset_v1.OutputConfig() + output_config.gcs_destination.uri = "uri_value" + request = asset_v1.ExportAssetsRequest( + parent="*", + output_config=output_config, ) # Make the request 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 e274800452..e4548eed7d 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 @@ -34,7 +34,12 @@ def sample_export_assets(): 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="*", + output_config=output_config, ) # Make the request 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 3c10ab1e18..c4078151b7 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 @@ -35,6 +35,7 @@ async def sample_get_feed(): # Initialize request argument(s) request = asset_v1.GetFeedRequest( + name="projects/{project}/feeds/{feed}", ) # Make the request 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 63dbf0c90c..cb53327cce 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 @@ -35,6 +35,7 @@ def sample_get_feed(): # Initialize request argument(s) request = asset_v1.GetFeedRequest( + name="projects/{project}/feeds/{feed}", ) # Make the request 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 3f79199a33..ff87a684fe 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 @@ -35,6 +35,7 @@ async def sample_list_assets(): # Initialize request argument(s) request = asset_v1.ListAssetsRequest( + parent="*", ) # Make the request 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 78dfb91b9e..47ed9d149b 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 @@ -35,6 +35,7 @@ def sample_list_assets(): # Initialize request argument(s) request = asset_v1.ListAssetsRequest( + parent="*", ) # Make the request 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 a15ad4a113..396b767010 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 @@ -35,6 +35,7 @@ async def sample_list_feeds(): # Initialize request argument(s) request = asset_v1.ListFeedsRequest( + parent="parent_value", ) # Make the request 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 2ad102f795..816523c64b 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 @@ -35,6 +35,7 @@ def sample_list_feeds(): # Initialize request argument(s) request = asset_v1.ListFeedsRequest( + parent="parent_value", ) # Make the request 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 b99fc9ac64..58fdd4b9bd 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 @@ -35,6 +35,7 @@ async def sample_search_all_iam_policies(): # Initialize request argument(s) request = asset_v1.SearchAllIamPoliciesRequest( + scope="scope_value", ) # Make the request 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 e142ae2fcb..dbe303e7fb 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 @@ -35,6 +35,7 @@ def sample_search_all_iam_policies(): # Initialize request argument(s) request = asset_v1.SearchAllIamPoliciesRequest( + scope="scope_value", ) # Make the request 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 2fc426361c..f0021cafdc 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 @@ -35,6 +35,7 @@ async def sample_search_all_resources(): # Initialize request argument(s) request = asset_v1.SearchAllResourcesRequest( + scope="scope_value", ) # Make the request 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 85d6799a35..ac0b998a06 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 @@ -35,6 +35,7 @@ def sample_search_all_resources(): # Initialize request argument(s) request = asset_v1.SearchAllResourcesRequest( + scope="scope_value", ) # Make the request 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 2386c5443d..12dd103c4b 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 @@ -34,7 +34,11 @@ async def sample_update_feed(): client = asset_v1.AssetServiceAsyncClient() # Initialize request argument(s) + feed = asset_v1.Feed() + feed.name = "name_value" + request = asset_v1.UpdateFeedRequest( + feed=feed, ) # Make the request 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 4dc4915cf5..3402c41d22 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 @@ -34,7 +34,11 @@ def sample_update_feed(): 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 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 de3341a690..b08ce8febc 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 @@ -35,6 +35,8 @@ async def sample_generate_access_token(): # Initialize request argument(s) request = credentials_v1.GenerateAccessTokenRequest( + name="projects/{project}/serviceAccounts/{service_account}", + scope=['scope_value'], ) # Make the request 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 24e4484bfc..357d62c459 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 @@ -35,6 +35,8 @@ def sample_generate_access_token(): # Initialize request argument(s) request = credentials_v1.GenerateAccessTokenRequest( + name="projects/{project}/serviceAccounts/{service_account}", + scope=['scope_value'], ) # Make the request 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 4417fcb6bb..d83bb8d933 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 @@ -35,6 +35,8 @@ async def sample_generate_id_token(): # Initialize request argument(s) request = credentials_v1.GenerateIdTokenRequest( + name="projects/{project}/serviceAccounts/{service_account}", + audience="audience_value", ) # Make the request 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 e23294e559..da92452b3d 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 @@ -35,6 +35,8 @@ def sample_generate_id_token(): # Initialize request argument(s) request = credentials_v1.GenerateIdTokenRequest( + name="projects/{project}/serviceAccounts/{service_account}", + audience="audience_value", ) # Make the request 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 3732426ff8..e71f7d3256 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 @@ -35,6 +35,8 @@ async def sample_sign_blob(): # Initialize request argument(s) request = credentials_v1.SignBlobRequest( + name="projects/{project}/serviceAccounts/{service_account}", + payload=b'payload_blob', ) # Make the request 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 51312014ff..40bd3ae561 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 @@ -35,6 +35,8 @@ def sample_sign_blob(): # Initialize request argument(s) request = credentials_v1.SignBlobRequest( + name="projects/{project}/serviceAccounts/{service_account}", + payload=b'payload_blob', ) # Make the request 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 ce4303485a..8ca3083307 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 @@ -35,6 +35,8 @@ async def sample_sign_jwt(): # Initialize request argument(s) request = credentials_v1.SignJwtRequest( + name="projects/{project}/serviceAccounts/{service_account}", + payload="payload_value", ) # Make the request 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 22b8600917..8dc778a594 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 @@ -35,6 +35,8 @@ def sample_sign_jwt(): # Initialize request argument(s) request = credentials_v1.SignJwtRequest( + name="projects/{project}/serviceAccounts/{service_account}", + payload="payload_value", ) # Make the request 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 4cb0f540ec..9425509149 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 @@ -35,6 +35,8 @@ async def sample_create_bucket(): # Initialize request argument(s) request = logging_v2.CreateBucketRequest( + parent="projects/{project}/locations/{location}/buckets/{bucket}", + bucket_id="bucket_id_value", ) # Make the request 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 004ee0a486..490adb5296 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 @@ -35,6 +35,8 @@ def sample_create_bucket(): # Initialize request argument(s) request = logging_v2.CreateBucketRequest( + parent="projects/{project}/locations/{location}/buckets/{bucket}", + bucket_id="bucket_id_value", ) # Make the request 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 1d0523610f..c41f337710 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 @@ -34,7 +34,13 @@ async def sample_create_exclusion(): client = logging_v2.ConfigServiceV2AsyncClient() # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + request = logging_v2.CreateExclusionRequest( + parent="projects/{project}/exclusions/{exclusion}", + exclusion=exclusion, ) # Make the request 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 ce102ad991..ac7e04733c 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 @@ -34,7 +34,13 @@ def sample_create_exclusion(): client = logging_v2.ConfigServiceV2Client() # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + request = logging_v2.CreateExclusionRequest( + parent="projects/{project}/exclusions/{exclusion}", + exclusion=exclusion, ) # Make the request 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 4678b4314f..0affba0c4b 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 @@ -34,7 +34,13 @@ async def sample_create_sink(): client = logging_v2.ConfigServiceV2AsyncClient() # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + request = logging_v2.CreateSinkRequest( + parent="projects/{project}/sinks/{sink}", + sink=sink, ) # Make the request 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 f47adb78d3..8bc2129be0 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 @@ -34,7 +34,13 @@ def sample_create_sink(): client = logging_v2.ConfigServiceV2Client() # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + request = logging_v2.CreateSinkRequest( + parent="projects/{project}/sinks/{sink}", + sink=sink, ) # Make the request 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 4fbcdd61a8..a9ced73e6a 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 @@ -35,6 +35,8 @@ async def sample_create_view(): # Initialize request argument(s) request = logging_v2.CreateViewRequest( + parent="parent_value", + view_id="view_id_value", ) # Make the request 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 eefdb75b88..bbb9033c5c 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 @@ -35,6 +35,8 @@ def sample_create_view(): # Initialize request argument(s) request = logging_v2.CreateViewRequest( + parent="parent_value", + view_id="view_id_value", ) # Make the request 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 8ca8c4748e..ed6a9173a4 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 @@ -35,6 +35,7 @@ async def sample_delete_bucket(): # Initialize request argument(s) request = logging_v2.DeleteBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 9616621b4e..bf107ae157 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 @@ -35,6 +35,7 @@ def sample_delete_bucket(): # Initialize request argument(s) request = logging_v2.DeleteBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 0e8df5d06c..73cf51dd59 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 @@ -35,6 +35,7 @@ async def sample_delete_exclusion(): # Initialize request argument(s) request = logging_v2.DeleteExclusionRequest( + name="projects/{project}/exclusions/{exclusion}", ) # Make the request 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 0268e93f28..d1ddf4aecc 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 @@ -35,6 +35,7 @@ def sample_delete_exclusion(): # Initialize request argument(s) request = logging_v2.DeleteExclusionRequest( + name="projects/{project}/exclusions/{exclusion}", ) # Make the request 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 d1aaaf9ca5..fa0ea94ec5 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 @@ -35,6 +35,7 @@ async def sample_delete_sink(): # Initialize request argument(s) request = logging_v2.DeleteSinkRequest( + sink_name="projects/{project}/sinks/{sink}", ) # Make the request 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 6bdc8b65dc..c432aa6709 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 @@ -35,6 +35,7 @@ def sample_delete_sink(): # Initialize request argument(s) request = logging_v2.DeleteSinkRequest( + sink_name="projects/{project}/sinks/{sink}", ) # Make the request 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 e9b1a1255c..ec9ce8c4ad 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 @@ -35,6 +35,7 @@ async def sample_delete_view(): # Initialize request argument(s) request = logging_v2.DeleteViewRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}/views/{view}", ) # Make the request 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 a27f4604d3..f866fb6b3a 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 @@ -35,6 +35,7 @@ def sample_delete_view(): # Initialize request argument(s) request = logging_v2.DeleteViewRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}/views/{view}", ) # Make the request 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 bf65579867..43ae4b5102 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 @@ -35,6 +35,7 @@ async def sample_get_bucket(): # Initialize request argument(s) request = logging_v2.GetBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 80470bf3c4..b729d8de74 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 @@ -35,6 +35,7 @@ def sample_get_bucket(): # Initialize request argument(s) request = logging_v2.GetBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 ece79ce221..bc085f29b5 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 @@ -35,6 +35,7 @@ async def sample_get_cmek_settings(): # Initialize request argument(s) request = logging_v2.GetCmekSettingsRequest( + name="projects/{project}/cmekSettings", ) # Make the request 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 19cef44934..b838221d5b 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 @@ -35,6 +35,7 @@ def sample_get_cmek_settings(): # Initialize request argument(s) request = logging_v2.GetCmekSettingsRequest( + name="projects/{project}/cmekSettings", ) # Make the request 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 9ce42101f1..d0766aa6a9 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 @@ -35,6 +35,7 @@ async def sample_get_exclusion(): # Initialize request argument(s) request = logging_v2.GetExclusionRequest( + name="projects/{project}/exclusions/{exclusion}", ) # Make the request 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 7712065b80..4f025180ef 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 @@ -35,6 +35,7 @@ def sample_get_exclusion(): # Initialize request argument(s) request = logging_v2.GetExclusionRequest( + name="projects/{project}/exclusions/{exclusion}", ) # Make the request 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 b1a69a1d6f..bc8889c48b 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 @@ -35,6 +35,7 @@ async def sample_get_sink(): # Initialize request argument(s) request = logging_v2.GetSinkRequest( + sink_name="projects/{project}/sinks/{sink}", ) # Make the request 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 e1d4ed0b81..54360300ea 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 @@ -35,6 +35,7 @@ def sample_get_sink(): # Initialize request argument(s) request = logging_v2.GetSinkRequest( + sink_name="projects/{project}/sinks/{sink}", ) # Make the request 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 5594e7ac23..c280eb79b3 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 @@ -35,6 +35,7 @@ async def sample_get_view(): # Initialize request argument(s) request = logging_v2.GetViewRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}/views/{view}", ) # Make the request 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 4865050cd9..ca94c6088b 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 @@ -35,6 +35,7 @@ def sample_get_view(): # Initialize request argument(s) request = logging_v2.GetViewRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}/views/{view}", ) # Make the request 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 ef7e8ba87a..0984985431 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 @@ -35,6 +35,7 @@ async def sample_list_buckets(): # Initialize request argument(s) request = logging_v2.ListBucketsRequest( + parent="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 2c1ea9332d..a6b0fc001a 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 @@ -35,6 +35,7 @@ def sample_list_buckets(): # Initialize request argument(s) request = logging_v2.ListBucketsRequest( + parent="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 c3d7f9165b..fa305a7f19 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 @@ -35,6 +35,7 @@ async def sample_list_exclusions(): # Initialize request argument(s) request = logging_v2.ListExclusionsRequest( + parent="projects/{project}/exclusions/{exclusion}", ) # Make the request 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 255e4851e4..c47b051b0e 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 @@ -35,6 +35,7 @@ def sample_list_exclusions(): # Initialize request argument(s) request = logging_v2.ListExclusionsRequest( + parent="projects/{project}/exclusions/{exclusion}", ) # Make the request 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 98d31d2535..0f44922bf6 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 @@ -35,6 +35,7 @@ async def sample_list_sinks(): # Initialize request argument(s) request = logging_v2.ListSinksRequest( + parent="projects/{project}/sinks/{sink}", ) # Make the request 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 d911ed8ed1..81dc1c7dbf 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 @@ -35,6 +35,7 @@ def sample_list_sinks(): # Initialize request argument(s) request = logging_v2.ListSinksRequest( + parent="projects/{project}/sinks/{sink}", ) # Make the request 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 7a24536f99..13ebc35295 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 @@ -35,6 +35,7 @@ async def sample_list_views(): # Initialize request argument(s) request = logging_v2.ListViewsRequest( + parent="parent_value", ) # Make the request 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 b87a931556..a61e856411 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 @@ -35,6 +35,7 @@ def sample_list_views(): # Initialize request argument(s) request = logging_v2.ListViewsRequest( + parent="parent_value", ) # Make the request 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 c0a8f1efa4..badbebdd6a 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 @@ -35,6 +35,7 @@ async def sample_undelete_bucket(): # Initialize request argument(s) request = logging_v2.UndeleteBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 8a4968c9f7..783b187d47 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 @@ -35,6 +35,7 @@ def sample_undelete_bucket(): # Initialize request argument(s) request = logging_v2.UndeleteBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 423986e3fc..4343a258b4 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 @@ -35,6 +35,7 @@ async def sample_update_bucket(): # Initialize request argument(s) request = logging_v2.UpdateBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 4b6a11c717..a2370594b3 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 @@ -35,6 +35,7 @@ def sample_update_bucket(): # Initialize request argument(s) request = logging_v2.UpdateBucketRequest( + name="projects/{project}/locations/{location}/buckets/{bucket}", ) # Make the request 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 67a9e4f2bc..6c868ad063 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 @@ -35,6 +35,7 @@ async def sample_update_cmek_settings(): # Initialize request argument(s) request = logging_v2.UpdateCmekSettingsRequest( + name="name_value", ) # Make the request 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 568a350a7b..9b7f34e9d1 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 @@ -35,6 +35,7 @@ def sample_update_cmek_settings(): # Initialize request argument(s) request = logging_v2.UpdateCmekSettingsRequest( + name="name_value", ) # Make the request 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 7f13ad361e..7ed53afeb7 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 @@ -34,7 +34,13 @@ async def sample_update_exclusion(): client = logging_v2.ConfigServiceV2AsyncClient() # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + request = logging_v2.UpdateExclusionRequest( + name="projects/{project}/exclusions/{exclusion}", + exclusion=exclusion, ) # Make the request 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 bc48f0654a..6adacd542a 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 @@ -34,7 +34,13 @@ def sample_update_exclusion(): client = logging_v2.ConfigServiceV2Client() # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + request = logging_v2.UpdateExclusionRequest( + name="projects/{project}/exclusions/{exclusion}", + exclusion=exclusion, ) # Make the request 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 a5d122924f..03c6b96b24 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 @@ -34,7 +34,13 @@ async def sample_update_sink(): client = logging_v2.ConfigServiceV2AsyncClient() # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + request = logging_v2.UpdateSinkRequest( + sink_name="projects/{project}/sinks/{sink}", + sink=sink, ) # Make the request 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 773e439985..3bc9c59e33 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 @@ -34,7 +34,13 @@ def sample_update_sink(): client = logging_v2.ConfigServiceV2Client() # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + request = logging_v2.UpdateSinkRequest( + sink_name="projects/{project}/sinks/{sink}", + sink=sink, ) # Make the request 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 0eda6b705c..e2a1f97e08 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 @@ -35,6 +35,7 @@ async def sample_update_view(): # Initialize request argument(s) request = logging_v2.UpdateViewRequest( + name="name_value", ) # Make the request 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 bd1ad230f7..fb5811dead 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 @@ -35,6 +35,7 @@ def sample_update_view(): # Initialize request argument(s) request = logging_v2.UpdateViewRequest( + name="name_value", ) # Make the request 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 b317c8d26c..70b50994f5 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 @@ -35,6 +35,7 @@ async def sample_delete_log(): # Initialize request argument(s) request = logging_v2.DeleteLogRequest( + log_name="projects/{project}/logs/{log}", ) # Make the request 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 0470d72af8..357ee19596 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 @@ -35,6 +35,7 @@ def sample_delete_log(): # Initialize request argument(s) request = logging_v2.DeleteLogRequest( + log_name="projects/{project}/logs/{log}", ) # Make the request 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 771ba15974..dc2f62c7d9 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 @@ -35,6 +35,7 @@ async def sample_list_log_entries(): # Initialize request argument(s) request = logging_v2.ListLogEntriesRequest( + resource_names="projects/{project}/logs/{log}", ) # Make the request 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 79aa53d23d..c1a6455f6d 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 @@ -35,6 +35,7 @@ def sample_list_log_entries(): # Initialize request argument(s) request = logging_v2.ListLogEntriesRequest( + resource_names="projects/{project}/logs/{log}", ) # Make the request 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 f9b2685a7d..a0e119a926 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 @@ -35,6 +35,7 @@ async def sample_list_logs(): # Initialize request argument(s) request = logging_v2.ListLogsRequest( + parent="projects/{project}/logs/{log}", ) # Make the request 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 2515bc936c..13a18b0ebd 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 @@ -35,6 +35,7 @@ def sample_list_logs(): # Initialize request argument(s) request = logging_v2.ListLogsRequest( + parent="projects/{project}/logs/{log}", ) # Make the request 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 6ee5862d94..3202818c3f 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 @@ -35,10 +35,11 @@ async def sample_tail_log_entries(): # Initialize request argument(s) request = logging_v2.TailLogEntriesRequest( + resource_names=['resource_names_value'], ) # Make the request - stream = await client.tail_log_entries([]) + stream = await client.tail_log_entries([resource_names=['resource_names_value']]) async for response in stream: print("{}".format(response)) 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 442a1f3cac..909a8e8aa2 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 @@ -35,10 +35,11 @@ def sample_tail_log_entries(): # Initialize request argument(s) request = logging_v2.TailLogEntriesRequest( + resource_names=['resource_names_value'], ) # Make the request - stream = client.tail_log_entries([]) + stream = client.tail_log_entries([resource_names=['resource_names_value']]) for response in stream: print("{}".format(response)) 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 da4353446d..1a6981c740 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 @@ -34,7 +34,11 @@ async def sample_write_log_entries(): client = logging_v2.LoggingServiceV2AsyncClient() # Initialize request argument(s) + entries = logging_v2.LogEntry() + entries.log_name = "log_name_value" + request = logging_v2.WriteLogEntriesRequest( + entries=entries, ) # Make the request 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 a74258a1de..fdce118737 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 @@ -34,7 +34,11 @@ def sample_write_log_entries(): 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 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 dc77adacf5..02f97a044b 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 @@ -34,7 +34,13 @@ async def sample_create_log_metric(): client = logging_v2.MetricsServiceV2AsyncClient() # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + request = logging_v2.CreateLogMetricRequest( + parent="projects/{project}/metrics/{metric}", + metric=metric, ) # Make the request 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 61131f6bdc..0f2c282498 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 @@ -34,7 +34,13 @@ def sample_create_log_metric(): client = logging_v2.MetricsServiceV2Client() # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + request = logging_v2.CreateLogMetricRequest( + parent="projects/{project}/metrics/{metric}", + metric=metric, ) # Make the request 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 939087d191..d0cc9d1c89 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 @@ -35,6 +35,7 @@ async def sample_delete_log_metric(): # Initialize request argument(s) request = logging_v2.DeleteLogMetricRequest( + metric_name="projects/{project}/metrics/{metric}", ) # Make the request 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 8a0451c319..e82eff3ea7 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 @@ -35,6 +35,7 @@ def sample_delete_log_metric(): # Initialize request argument(s) request = logging_v2.DeleteLogMetricRequest( + metric_name="projects/{project}/metrics/{metric}", ) # Make the request 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 64eb3f59f4..effabeb34f 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 @@ -35,6 +35,7 @@ async def sample_get_log_metric(): # Initialize request argument(s) request = logging_v2.GetLogMetricRequest( + metric_name="projects/{project}/metrics/{metric}", ) # Make the request 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 7115ee688b..d49f387ac1 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 @@ -35,6 +35,7 @@ def sample_get_log_metric(): # Initialize request argument(s) request = logging_v2.GetLogMetricRequest( + metric_name="projects/{project}/metrics/{metric}", ) # Make the request 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 9acfc76ee8..23a495c163 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 @@ -35,6 +35,7 @@ async def sample_list_log_metrics(): # Initialize request argument(s) request = logging_v2.ListLogMetricsRequest( + parent="projects/{project}", ) # Make the request 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 702a286711..dcc0784eda 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 @@ -35,6 +35,7 @@ def sample_list_log_metrics(): # Initialize request argument(s) request = logging_v2.ListLogMetricsRequest( + parent="projects/{project}", ) # Make the request 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 c25de0cd5f..080789a8af 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 @@ -34,7 +34,13 @@ async def sample_update_log_metric(): client = logging_v2.MetricsServiceV2AsyncClient() # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + request = logging_v2.UpdateLogMetricRequest( + metric_name="projects/{project}/metrics/{metric}", + metric=metric, ) # Make the request 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 89167019ac..1c5ce5af9d 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 @@ -34,7 +34,13 @@ def sample_update_log_metric(): client = logging_v2.MetricsServiceV2Client() # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + request = logging_v2.UpdateLogMetricRequest( + metric_name="projects/{project}/metrics/{metric}", + metric=metric, ) # Make the request 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 dbfed3042b..b3705e3af7 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 @@ -34,7 +34,15 @@ async def sample_create_instance(): client = redis_v1.CloudRedisAsyncClient() # Initialize request argument(s) + instance = redis_v1.Instance() + instance.name = "name_value" + instance.tier = "STANDARD_HA" + instance.memory_size_gb = 1499 + request = redis_v1.CreateInstanceRequest( + parent="projects/{project}/locations/{location}", + instance_id="instance_id_value", + instance=instance, ) # Make the request 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 8b874ba3c9..16f1ed86af 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 @@ -34,7 +34,15 @@ def sample_create_instance(): 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.CreateInstanceRequest( + parent="projects/{project}/locations/{location}", + instance_id="instance_id_value", + instance=instance, ) # Make the request 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 2a706ace31..58ad65f234 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 @@ -35,6 +35,7 @@ async def sample_delete_instance(): # Initialize request argument(s) request = redis_v1.DeleteInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", ) # Make the request 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 f2bfcef905..85ea9b2e70 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 @@ -35,6 +35,7 @@ def sample_delete_instance(): # Initialize request argument(s) request = redis_v1.DeleteInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", ) # Make the request 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 9cbe0ee552..01a418c516 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 @@ -34,7 +34,12 @@ async def sample_export_instance(): client = redis_v1.CloudRedisAsyncClient() # 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 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 f6ec74e9e8..f00a794b53 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 @@ -34,7 +34,12 @@ def sample_export_instance(): 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 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 441dd31f6a..23f4aa9135 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 @@ -35,6 +35,7 @@ async def sample_failover_instance(): # Initialize request argument(s) request = redis_v1.FailoverInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", ) # Make the request 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 f80743627e..9de974244a 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 @@ -35,6 +35,7 @@ def sample_failover_instance(): # Initialize request argument(s) request = redis_v1.FailoverInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", ) # Make the request 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 390c4f9b1a..87273f1da4 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 @@ -35,6 +35,7 @@ async def sample_get_instance(): # Initialize request argument(s) request = redis_v1.GetInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", ) # Make the request 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 c7ee84f231..d72d199eb2 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 @@ -35,6 +35,7 @@ def sample_get_instance(): # Initialize request argument(s) request = redis_v1.GetInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", ) # Make the request 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 fff17dfa84..4f5137291e 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 @@ -34,7 +34,12 @@ async def sample_import_instance(): client = redis_v1.CloudRedisAsyncClient() # 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 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 19feb13215..3cbe064838 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 @@ -34,7 +34,12 @@ def sample_import_instance(): 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 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 33d0758f39..9ef268347e 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 @@ -35,6 +35,7 @@ async def sample_list_instances(): # Initialize request argument(s) request = redis_v1.ListInstancesRequest( + parent="projects/{project}/locations/{location}", ) # Make the request 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 df9296d34a..5cbdd38184 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 @@ -35,6 +35,7 @@ def sample_list_instances(): # Initialize request argument(s) request = redis_v1.ListInstancesRequest( + parent="projects/{project}/locations/{location}", ) # Make the request 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 3f6263abc0..cc2340794a 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 @@ -34,7 +34,13 @@ async def sample_update_instance(): client = redis_v1.CloudRedisAsyncClient() # 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 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 e363d28c11..a98f88b579 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 @@ -34,7 +34,13 @@ def sample_update_instance(): 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 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 1ae6bc3a6a..b170fb02d9 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 @@ -35,6 +35,8 @@ async def sample_upgrade_instance(): # Initialize request argument(s) request = redis_v1.UpgradeInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", + redis_version="redis_version_value", ) # Make the request 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 60759777e0..c1b6caf8b5 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 @@ -35,6 +35,8 @@ def sample_upgrade_instance(): # Initialize request argument(s) request = redis_v1.UpgradeInstanceRequest( + name="projects/{project}/locations/{location}/instances/{instance}", + redis_version="redis_version_value", ) # Make the request 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 72a2f65950..6d6afcf994 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 @@ -35,6 +35,7 @@ async def sample_list_resources(): # Initialize request argument(s) request = mollusca_v1.ListResourcesRequest( + parent="items/{item_id}/parts/{part_id}", ) # Make the request 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 e7423eaf3d..9ca10fc35c 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 @@ -35,6 +35,7 @@ def sample_list_resources(): # Initialize request argument(s) request = mollusca_v1.ListResourcesRequest( + parent="items/{item_id}/parts/{part_id}", ) # Make the request 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 26ab1b086c..d34f0a980d 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 @@ -34,11 +34,12 @@ async def sample_method_bidi_streaming(): client = mollusca_v1.SnippetsAsyncClient() # Initialize request argument(s) - request = mollusca_v1.SignatureRequest( + request = mollusca_v1.SignatureRequestOneRequiredField( + my_string="my_string_value", ) # Make the request - stream = await client.method_bidi_streaming([]) + stream = await client.method_bidi_streaming([my_string="my_string_value"]) async for response in stream: print("{}".format(response)) 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 239eeb7763..daba69f1b6 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 @@ -34,11 +34,12 @@ def sample_method_bidi_streaming(): client = mollusca_v1.SnippetsClient() # Initialize request argument(s) - request = mollusca_v1.SignatureRequest( + request = mollusca_v1.SignatureRequestOneRequiredField( + my_string="my_string_value", ) # Make the request - stream = client.method_bidi_streaming([]) + stream = client.method_bidi_streaming([my_string="my_string_value"]) for response in stream: print("{}".format(response)) 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 3327f9a2b4..61497f4a43 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 @@ -34,7 +34,16 @@ async def sample_method_lro_signatures(): client = mollusca_v1.SnippetsAsyncClient() # Initialize request argument(s) + my_message = mollusca_v1.MessageWithNesting() + my_message.message.required_string = "required_string_value" + my_message.my_int = 656 + request = mollusca_v1.SignatureRequest( + my_string="my_string_value", + my_int=656, + my_bool=True, + my_message=my_message, + single_enum="DEFAULT", ) # Make the request 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 af22fb4125..ea51e76e12 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 @@ -34,7 +34,16 @@ def sample_method_lro_signatures(): client = mollusca_v1.SnippetsClient() # Initialize request argument(s) + my_message = mollusca_v1.MessageWithNesting() + my_message.message.required_string = "required_string_value" + my_message.my_int = 656 + request = mollusca_v1.SignatureRequest( + my_string="my_string_value", + my_int=656, + my_bool=True, + my_message=my_message, + single_enum="DEFAULT", ) # Make the request 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 b8f4629577..f7351c4b36 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 @@ -34,7 +34,16 @@ async def sample_method_one_signature(): client = mollusca_v1.SnippetsAsyncClient() # Initialize request argument(s) + my_message = mollusca_v1.MessageWithNesting() + my_message.message.required_string = "required_string_value" + my_message.my_int = 656 + request = mollusca_v1.SignatureRequest( + my_string="my_string_value", + my_int=656, + my_bool=True, + my_message=my_message, + single_enum="DEFAULT", ) # Make the request 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 e8e438f169..dcb1a81f0e 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 @@ -34,7 +34,16 @@ def sample_method_one_signature(): client = mollusca_v1.SnippetsClient() # Initialize request argument(s) + my_message = mollusca_v1.MessageWithNesting() + my_message.message.required_string = "required_string_value" + my_message.my_int = 656 + request = mollusca_v1.SignatureRequest( + my_string="my_string_value", + my_int=656, + my_bool=True, + my_message=my_message, + single_enum="DEFAULT", ) # Make the request 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 753c7666e5..785c22899a 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 @@ -34,7 +34,16 @@ async def sample_method_server_streaming(): client = mollusca_v1.SnippetsAsyncClient() # Initialize request argument(s) + my_message = mollusca_v1.MessageWithNesting() + my_message.message.required_string = "required_string_value" + my_message.my_int = 656 + request = mollusca_v1.SignatureRequest( + my_string="my_string_value", + my_int=656, + my_bool=True, + my_message=my_message, + single_enum="DEFAULT", ) # Make the request 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 339623a2d6..5894bff3e9 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 @@ -34,7 +34,16 @@ def sample_method_server_streaming(): client = mollusca_v1.SnippetsClient() # Initialize request argument(s) + my_message = mollusca_v1.MessageWithNesting() + my_message.message.required_string = "required_string_value" + my_message.my_int = 656 + request = mollusca_v1.SignatureRequest( + my_string="my_string_value", + my_int=656, + my_bool=True, + my_message=my_message, + single_enum="DEFAULT", ) # Make the request 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 new file mode 100644 index 0000000000..fee612e387 --- /dev/null +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for OneOfMethod +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install animalia-mollusca + + +# [START mollusca_generated_mollusca_v1_Snippets_OneOfMethod_async] +from animalia import mollusca_v1 + + +async def sample_one_of_method(): + """Snippet for one_of_method""" + + # Create a client + client = mollusca_v1.SnippetsAsyncClient() + + # Initialize request argument(s) + request = mollusca_v1.OneOfRequest( + my_string="my_string_value", + non_one_of_string="non_one_of_string_value", + ) + + # Make the request + response = await client.one_of_method(request=request) + + # Handle response + print("{}".format(response)) + +# [END mollusca_generated_mollusca_v1_Snippets_OneOfMethod_async] 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 new file mode 100644 index 0000000000..71efe54950 --- /dev/null +++ b/tests/snippetgen/goldens/mollusca_generated_mollusca_v1_snippets_one_of_method_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for OneOfMethod +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install animalia-mollusca + + +# [START mollusca_generated_mollusca_v1_Snippets_OneOfMethod_sync] +from animalia import mollusca_v1 + + +def sample_one_of_method(): + """Snippet for one_of_method""" + + # Create a client + client = mollusca_v1.SnippetsClient() + + # Initialize request argument(s) + request = mollusca_v1.OneOfRequest( + my_string="my_string_value", + non_one_of_string="non_one_of_string_value", + ) + + # Make the request + response = client.one_of_method(request=request) + + # Handle response + print("{}".format(response)) + +# [END mollusca_generated_mollusca_v1_Snippets_OneOfMethod_sync] diff --git a/tests/snippetgen/snippets.proto b/tests/snippetgen/snippets.proto index 6aaa404bcf..d5bbb9f78b 100644 --- a/tests/snippetgen/snippets.proto +++ b/tests/snippetgen/snippets.proto @@ -29,11 +29,11 @@ service Snippets { option (google.api.default_host) = "mollusca.example.com"; rpc MethodOneSignature(SignatureRequest) returns(Response) { - option (google.api.method_signature) = "a_string,an_int,a_bool"; + option (google.api.method_signature) = "my_string,my_int,my_bool"; } rpc MethodLroSignatures(SignatureRequest) returns(google.longrunning.Operation) { - option (google.api.method_signature) = "a_string,an_int,a_bool"; + option (google.api.method_signature) = "my_string,my_int,my_bool"; option (google.longrunning.operation_info) = { response_type: "LroResponse" metadata_type: "LroMetadata" @@ -48,18 +48,24 @@ service Snippets { } rpc MethodServerStreaming(SignatureRequest) returns(stream Response) { - option (google.api.method_signature) = "a_string,a_bool"; + option (google.api.method_signature) = "my_string,my_int,my_bool"; option (google.api.method_signature) = ""; } - rpc MethodBidiStreaming(stream SignatureRequest) returns (stream Response); + rpc MethodBidiStreaming(stream SignatureRequestOneRequiredField) returns (stream Response); + + rpc OneOfMethod(OneOfRequest) returns (Response); +} + +enum Enum { + DEFAULT = 0; // First value must be 0 and is the default } message ListResourcesRequest { string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - child_type: "snippets.example.com/Resource" + type: "snippets.example.com/Resource" }]; int32 page_size = 2; @@ -85,16 +91,35 @@ message Resource { pattern: "items/{item_id}/parts/{part_id}" }; string name = 1; + + +} + +message MessageWithNesting { + message NestedMessage { + string required_string = 1 [(google.api.field_behavior) = REQUIRED]; + string optional_string = 2; + } + + NestedMessage message = 1 [(google.api.field_behavior) = REQUIRED]; + int32 my_int = 2 [(google.api.field_behavior) = REQUIRED]; } +message SignatureRequestOneRequiredField { + string my_string = 1 [(google.api.field_behavior) = REQUIRED]; +} + message SignatureRequest { - string a_string = 1; - int32 an_int = 2; - bool a_bool = 3; + string my_string = 1 [(google.api.field_behavior) = REQUIRED]; + int32 my_int = 2 [(google.api.field_behavior) = REQUIRED]; + bool my_bool = 3 [(google.api.field_behavior) = REQUIRED]; map map_int_string = 4; + MessageWithNesting my_message = 5 [(google.api.field_behavior) = REQUIRED]; + Enum single_enum = 6 [(google.api.field_behavior) = REQUIRED]; } + message Response { } @@ -104,3 +129,10 @@ message LroResponse { message LroMetadata { } +message OneOfRequest { + string non_one_of_string = 1 [(google.api.field_behavior) = REQUIRED]; + oneof my_one_of { + string my_string = 2; + int32 my_number = 3; + } +} diff --git a/tests/unit/samplegen/common_types.py b/tests/unit/samplegen/common_types.py index 0e9c8129d1..c0e3fc83e4 100644 --- a/tests/unit/samplegen/common_types.py +++ b/tests/unit/samplegen/common_types.py @@ -39,22 +39,56 @@ class DummyMethod: DummyIdent = namedtuple("DummyIdent", ["name"]) -DummyMessage = namedtuple( - "DummyMessage", ["fields", "type", "options", "ident"]) -DummyMessage.__new__.__defaults__ = (False,) * len(DummyMessage._fields) +DummyMessageTypePB = namedtuple("DummyMessageTypePB", ["name"]) -DummyField = namedtuple("DummyField", +# DummyMessageBase = namedtuple( +# "DummyMessage", ["fields", "type", "options", "ident",]) +# DummyMessageBase.__new__.__defaults__ = (False,) * len(DummyMessageBase._fields) + + +DummyFieldBase = namedtuple("DummyField", ["message", "enum", "name", "repeated", + "required", + "resource_reference", + "oneof", "field_pb", "meta", "is_primitive", "type"]) -DummyField.__new__.__defaults__ = (False,) * len(DummyField._fields) +DummyFieldBase.__new__.__defaults__ = (False,) * len(DummyFieldBase._fields) + + +class DummyField(DummyFieldBase): + @property + def mock_value_original_type(self): + return "mock_value" + + +class DummyMessage: + def __init__(self, *, fields={}, type="", options=False, ident=False, resource_path=False): + self.fields = fields + self.type = type + self.options = options + self.ident = ident + self.resource_path = resource_path + + def get_field(self, field_name: str): + return self.fields[field_name] + + def oneof_fields(self): + return dict((field.oneof, field) for field in self.fields.values() if field.oneof) + + @property + def required_fields(self): + return [field for field in self.fields.values() if field.required] + -DummyService = namedtuple("DummyService", ["methods", "client_name"]) +DummyService = namedtuple("DummyService", [ + "methods", "client_name", "async_client_name", "resource_messages_dict"]) +DummyService.__new__.__defaults__ = (False,) * len(DummyService._fields) DummyApiSchema = namedtuple("DummyApiSchema", ["services", "naming", "messages"]) @@ -76,7 +110,8 @@ def message_factory(exp: str, # used to describe the field and type hierarchy, # e.g. "mollusc.cephalopod.coleoid" toks = exp.split(".") - messages = [DummyMessage({}, tok.upper() + "_TYPE") for tok in toks] + messages = [DummyMessage(fields={}, type=tok.upper() + "_TYPE") + for tok in toks] if enum: messages[-1] = enum diff --git a/tests/unit/samplegen/golden_snippets/sample_basic.py b/tests/unit/samplegen/golden_snippets/sample_basic.py index 5310595732..b1fdedea41 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic.py @@ -34,13 +34,14 @@ def sample_classify(video, location): client = molluscclient.MolluscServiceClient() # Initialize request argument(s) - classify_target = {} + classify_target = molluscclient.ClassifyTarget() + # video = "path/to/mollusc/video.mkv" with open(video, "rb") as f: - classify_target["video"] = f.read() + classify_target.video = f.read() # location = "New Zealand" - classify_target["location_annotation"] = location + classify_target.location_annotation = location request = molluscclient.molluscs.v1.ClassifyRequest( classify_target=classify_target, diff --git a/tests/unit/samplegen/golden_snippets/sample_basic_async.py b/tests/unit/samplegen/golden_snippets/sample_basic_async.py index 5aa99485ad..59fde511d2 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic_async.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic_async.py @@ -34,13 +34,14 @@ async def sample_classify(video, location): client = molluscclient.MolluscServiceAsyncClient() # Initialize request argument(s) - classify_target = {} + classify_target = molluscclient.ClassifyTarget() + # video = "path/to/mollusc/video.mkv" with open(video, "rb") as f: - classify_target["video"] = f.read() + classify_target.video = f.read() # location = "New Zealand" - classify_target["location_annotation"] = location + classify_target.location_annotation = location request = molluscclient.molluscs.v1.ClassifyRequest( classify_target=classify_target, diff --git a/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py b/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py index 5310595732..b1fdedea41 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic_unflattenable.py @@ -34,13 +34,14 @@ def sample_classify(video, location): client = molluscclient.MolluscServiceClient() # Initialize request argument(s) - classify_target = {} + classify_target = molluscclient.ClassifyTarget() + # video = "path/to/mollusc/video.mkv" with open(video, "rb") as f: - classify_target["video"] = f.read() + classify_target.video = f.read() # location = "New Zealand" - classify_target["location_annotation"] = location + classify_target.location_annotation = location request = molluscclient.molluscs.v1.ClassifyRequest( classify_target=classify_target, 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 47fe245290..a6e7d48b6e 100644 --- a/tests/unit/samplegen/golden_snippets/sample_basic_void_method.py +++ b/tests/unit/samplegen/golden_snippets/sample_basic_void_method.py @@ -34,13 +34,14 @@ def sample_classify(video, location): client = molluscclient.MolluscServiceClient() # Initialize request argument(s) - classify_target = {} + classify_target = molluscclient.ClassifyTarget() + # video = "path/to/mollusc/video.mkv" with open(video, "rb") as f: - classify_target["video"] = f.read() + classify_target.video = f.read() # location = "New Zealand" - classify_target["location_annotation"] = location + classify_target.location_annotation = location request = molluscclient.molluscs.v1.ClassifyRequest( classify_target=classify_target, diff --git a/tests/unit/samplegen/test_integration.py b/tests/unit/samplegen/test_integration.py index 8b88830147..95b7e74f53 100644 --- a/tests/unit/samplegen/test_integration.py +++ b/tests/unit/samplegen/test_integration.py @@ -24,7 +24,8 @@ from gapic.schema import (naming, wrappers) from tests.unit.samplegen.common_types import (DummyField, DummyMessage, - DummyMethod, DummyService, DummyIdent, + + DummyMessageTypePB, DummyMethod, DummyService, DummyIdent, DummyApiSchema, DummyNaming, enum_factory, message_factory) from collections import namedtuple @@ -62,13 +63,16 @@ def test_generate_sample_basic(): type="REQUEST TYPE", fields={ "classify_target": DummyField( + type=DummyMessageTypePB(name="ClassifyTarget"), message=DummyMessage( type="CLASSIFY TYPE", fields={ "video": DummyField( + type=DummyMessageTypePB(name="Video"), message=DummyMessage(type="VIDEO TYPE"), ), "location_annotation": DummyField( + type=DummyMessageTypePB(name="Location"), message=DummyMessage(type="LOCATION TYPE"), ) }, @@ -134,13 +138,16 @@ def test_generate_sample_basic_async(): type="REQUEST TYPE", fields={ "classify_target": DummyField( + type=DummyMessageTypePB(name="ClassifyTarget"), message=DummyMessage( - type="CLASSIFY TYPE", + type=DummyMessageTypePB(name="CLASSIFY TYPE"), fields={ "video": DummyField( + type=DummyMessageTypePB(name="Video"), message=DummyMessage(type="VIDEO TYPE"), ), "location_annotation": DummyField( + type=DummyMessageTypePB(name="Location"), message=DummyMessage(type="LOCATION TYPE"), ) }, @@ -206,13 +213,15 @@ def test_generate_sample_basic_unflattenable(): type="REQUEST TYPE", fields={ "classify_target": DummyField( + type=DummyMessageTypePB(name="ClassifyTarget"), message=DummyMessage( - type="CLASSIFY TYPE", fields={ "video": DummyField( + type=DummyMessageTypePB(name="Video"), message=DummyMessage(type="VIDEO TYPE"), ), "location_annotation": DummyField( + type=DummyMessageTypePB(name="Location"), message=DummyMessage(type="LOCATION TYPE"), ) }, @@ -269,13 +278,15 @@ def test_generate_sample_void_method(): type="REQUEST TYPE", fields={ "classify_target": DummyField( + type=DummyMessageTypePB(name="ClassifyTarget"), message=DummyMessage( - type="CLASSIFY TYPE", fields={ "video": DummyField( + type=DummyMessageTypePB(name="Video"), message=DummyMessage(type="VIDEO TYPE"), ), "location_annotation": DummyField( + type=DummyMessageTypePB(name="Location"), message=DummyMessage(type="LOCATION TYPE"), ) }, diff --git a/tests/unit/samplegen/test_samplegen.py b/tests/unit/samplegen/test_samplegen.py index 73798ce842..e9c9913d0f 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, +from common_types import (DummyApiSchema, DummyField, DummyIdent, DummyNaming, DummyMessage, DummyMessageTypePB, DummyService, DummyMethod, message_factory, enum_factory) from gapic.samplegen_utils import utils @@ -85,15 +85,25 @@ def test_define_redefinition(): def test_preprocess_sample(): # Verify that the default response is added. sample = {"service": "Mollusc", "rpc": "Classify"} + + classify_request_message = DummyMessage( + fields={ + "parent": DummyField(is_primitive=True, type=str, required=True, name="parent"), + }, + type=DummyMessageTypePB(name="ClassifyRequest"), + ident=DummyIdent(name="ClassifyRequest") + ) + api_schema = DummyApiSchema( services={"Mollusc": DummyService( - methods={}, client_name="MolluscClient")}, + methods={}, client_name="MolluscClient", + resource_messages_dict={})}, naming=DummyNaming(warehouse_package_name="mollusc-cephalopod-teuthida-", versioned_module_name="teuthida_v1", module_namespace="mollusc.cephalopod"), + messages=classify_request_message ) - rpc = DummyMethod(input=DummyMessage( - ident=DummyIdent(name="ClassifyRequest"))) + rpc = DummyMethod(input=classify_request_message) samplegen.Validator.preprocess_sample(sample, api_schema, rpc) @@ -113,7 +123,149 @@ def test_preprocess_sample(): assert client_name == "MolluscClient" request_type = sample.get("request_type") - assert request_type == "ClassifyRequest" + assert request_type.ident.name == "ClassifyRequest" + + # assert mock request is created + assert sample["request"] == [ + { + "field": "parent", + "value": "mock_value" + } + ] + + +def test_preprocess_sample_resource_message_field(): + # Verify that the default response is added. + sample = {"service": "Mollusc", "rpc": "Classify"} + + classify_request_message = DummyMessage( + fields={ + "parent": DummyField(is_primitive=True, type=str, required=True, name="parent", resource_reference="parent"), + }, + type=DummyMessageTypePB(name="ClassifyRequest"), + ident=DummyIdent(name="ClassifyRequest") + ) + + api_schema = DummyApiSchema( + services={"Mollusc": DummyService( + methods={}, client_name="MolluscClient", + resource_messages_dict={"parent": DummyMessage( + resource_path="projects/{project}")} + )}, + naming=DummyNaming(warehouse_package_name="mollusc-cephalopod-teuthida-", + versioned_module_name="teuthida_v1", module_namespace="mollusc.cephalopod"), + messages=classify_request_message, + + ) + + rpc = DummyMethod(input=classify_request_message) + + samplegen.Validator.preprocess_sample(sample, api_schema, rpc) + + # assert mock request is created + assert sample["request"] == [ + { + "field": "parent", + "value": "projects/{project}" + } + ] + + +def test_preprocess_sample_with_enum_field(): + # Verify that the default response is added. + sample = {"service": "Mollusc", "rpc": "Classify"} + + classify_request_message = DummyMessage( + fields={ + "type": DummyField( + name="type", + required=True, + type=enum_factory("type", ["TYPE_1", "TYPE_2"]), + enum=enum_factory("type", ["TYPE_1", "TYPE_2"]) + ) + }, + type=DummyMessageTypePB(name="ClassifyRequest"), + ident=DummyIdent(name="ClassifyRequest") + ) + + api_schema = DummyApiSchema( + services={"Mollusc": DummyService( + methods={}, client_name="MolluscClient", + resource_messages_dict={})}, + naming=DummyNaming(warehouse_package_name="mollusc-cephalopod-teuthida-", + versioned_module_name="teuthida_v1", module_namespace="mollusc.cephalopod"), + messages=classify_request_message + ) + + rpc = DummyMethod(input=classify_request_message) + + samplegen.Validator.preprocess_sample(sample, api_schema, rpc) + + response = sample.get("response") + assert response == [{"print": ["%s", "$resp"]}] + + package_name = sample.get("package_name") + assert package_name == "mollusc-cephalopod-teuthida-" + + module_name = sample.get("module_name") + assert module_name == "teuthida_v1" + + module_namespace = sample.get("module_namespace") + assert module_namespace == "mollusc.cephalopod" + + client_name = sample.get("client_name") + assert client_name == "MolluscClient" + + request_type = sample.get("request_type") + assert request_type.ident.name == "ClassifyRequest" + + # assert mock request is created + assert sample["request"] == [ + { + "field": "type", + "value": "TYPE_2" + } + ] + + +def test_preprocess_sample_nested_message_field(): + # Verify that the default response is added. + sample = {"service": "Mollusc", "rpc": "Classify"} + + classify_request_message = DummyMessage( + fields={ + "config": DummyField(name="config", is_primitive=False, required=True, oneof=False, type=DummyMessage( + fields={"name": DummyField( + is_primitive=True, type=str, name="name", required=True, oneof=False)}, + )) + }, + type=DummyMessageTypePB(name="ClassifyRequest"), + ident=DummyIdent(name="ClassifyRequest") + ) + + api_schema = DummyApiSchema( + services={"Mollusc": DummyService( + methods={}, client_name="MolluscClient", + resource_messages_dict={} + )}, + naming=DummyNaming(warehouse_package_name="mollusc-cephalopod-teuthida-", + versioned_module_name="teuthida_v1", module_namespace="mollusc.cephalopod"), + messages=classify_request_message, + + ) + + rpc = DummyMethod(input=classify_request_message) + + samplegen.Validator.preprocess_sample(sample, api_schema, rpc) + + # assert mock request is created + assert sample["request"] == [ + { + "field": "config.name", + "value": "mock_value" + }, + + ] def test_preprocess_sample_void_method(): @@ -1919,7 +2071,6 @@ def test_generate_sample_spec_basic(): "sample_type": "standalone", "rpc": "Ramshorn", "transport": "grpc", - "request": [], "service": "animalia.mollusca.v1.Squid", "region_tag": "example_generated_mollusca_v1_Squid_Ramshorn_sync", "description": "Snippet for ramshorn" @@ -1929,7 +2080,6 @@ def test_generate_sample_spec_basic(): "sample_type": "standalone", "rpc": "Ramshorn", "transport": "grpc-async", - "request": [], "service": "animalia.mollusca.v1.Squid", "region_tag": "example_generated_mollusca_v1_Squid_Ramshorn_async", "description": "Snippet for ramshorn" diff --git a/tests/unit/samplegen/test_template.py b/tests/unit/samplegen/test_template.py index edd7e3b0fe..edf59a925f 100644 --- a/tests/unit/samplegen/test_template.py +++ b/tests/unit/samplegen/test_template.py @@ -64,7 +64,7 @@ def test_render_attr_value(): {{ frags.render_request_attr("mollusc", request) }} ''', ''' - mollusc["order"] = Molluscs.Cephalopoda.Coleoidea + mollusc.order = Molluscs.Cephalopoda.Coleoidea ''', request=samplegen.AttributeRequestSetup( field="order", @@ -80,8 +80,9 @@ def test_render_attr_input_parameter(): {{ frags.render_request_attr("squid", request) }} ''', ''' + # species = 'Humboldt' - squid["species"] = species + squid.species = species ''', request=samplegen.AttributeRequestSetup(field="species", value="'Humboldt'", @@ -95,9 +96,10 @@ def test_render_attr_file(): {{ frags.render_request_attr("classify_mollusc_request", request) }} ''', ''' + # mollusc_video_path = 'path/to/mollusc/video.mkv' with open(mollusc_video_path, "rb") as f: - classify_mollusc_request["mollusc_video"] = f.read() + classify_mollusc_request.mollusc_video = f.read() ''', request=samplegen.AttributeRequestSetup(field="mollusc_video", value="'path/to/mollusc/video.mkv'", @@ -110,29 +112,29 @@ def test_render_request_basic(): check_template( ''' {% import "feature_fragments.j2" as frags %} - {{ frags.render_request_setup(request) }} + {{ frags.render_request_setup(request, module_name, request_type) }} ''', ''' # Initialize request argument(s) - cephalopod = {} + cephalopod = mollusca.Cephalopod() + # cephalopod_mass = '10 kg' - cephalopod["mantle_mass"] = cephalopod_mass + cephalopod.mantle_mass = cephalopod_mass # photo_path = 'path/to/cephalopod/photo.jpg' with open(photo_path, "rb") as f: - cephalopod["photo"] = f.read() + cephalopod.photo = f.read() + cephalopod.order = Molluscs.Cephalopoda.Coleoidea - cephalopod["order"] = Molluscs.Cephalopoda.Coleoidea + gastropod = mollusca.Gastropod() - gastropod = {} # gastropod_mass = '1 kg' - gastropod["mantle_mass"] = gastropod_mass - - gastropod["order"] = Molluscs.Gastropoda.Pulmonata + gastropod.mantle_mass = gastropod_mass + gastropod.order = Molluscs.Gastropoda.Pulmonata # movie_path = 'path/to/gastropod/movie.mkv' with open(movie_path, "rb") as f: - gastropod["movie"] = f.read() + gastropod.movie = f.read() ''', request=samplegen.FullRequest( @@ -176,6 +178,19 @@ def test_render_request_basic(): single=None), ], flattenable=True, + ), + module_name="mollusca", + request_type=common_types.DummyMessage( + fields={ + "cephalopod": common_types.DummyField( + name="cephalopod", + type=common_types.DummyMessageTypePB(name="Cephalopod") + ), + "gastropod": common_types.DummyField( + name="gastropod", + type=common_types.DummyMessageTypePB(name="Gastropod") + ) + } ) ) @@ -184,29 +199,29 @@ def test_render_request_unflattened(): check_template( ''' {% import "feature_fragments.j2" as frags %} - {{ frags.render_request_setup(request, "mollusca", "CreateMolluscRequest") }} + {{ frags.render_request_setup(request, module_name, request_type) }} ''', ''' # Initialize request argument(s) - cephalopod = {} + cephalopod = mollusca.Cephalopod() + # cephalopod_mass = '10 kg' - cephalopod["mantle_mass"] = cephalopod_mass + cephalopod.mantle_mass = cephalopod_mass # photo_path = 'path/to/cephalopod/photo.jpg' with open(photo_path, "rb") as f: - cephalopod["photo"] = f.read() + cephalopod.photo = f.read() + cephalopod.order = Molluscs.Cephalopoda.Coleoidea - cephalopod["order"] = Molluscs.Cephalopoda.Coleoidea + gastropod = mollusca.Gastropod() - gastropod = {} # gastropod_mass = '1 kg' - gastropod["mantle_mass"] = gastropod_mass - - gastropod["order"] = Molluscs.Gastropoda.Pulmonata + gastropod.mantle_mass = gastropod_mass + gastropod.order = Molluscs.Gastropoda.Pulmonata # movie_path = 'path/to/gastropod/movie.mkv' with open(movie_path, "rb") as f: - gastropod["movie"] = f.read() + gastropod.movie = f.read() request = mollusca.CreateMolluscRequest( cephalopod=cephalopod, @@ -255,11 +270,25 @@ def test_render_request_unflattened(): single=None), samplegen.TransformedRequest(base="bivalve", body=None, - single='"humboldt"'), + single=samplegen.AttributeRequestSetup( + value='"humboldt"', + ),), ] ), - api=common_types.DummyApiSchema(), - + module_name="mollusca", + request_type=common_types.DummyMessage( + fields={ + "cephalopod": common_types.DummyField( + name="cephalopod", + type=common_types.DummyMessageTypePB(name="Cephalopod") + ), + "gastropod": common_types.DummyField( + name="gastropod", + type=common_types.DummyMessageTypePB(name="Gastropod") + ) + }, + ident=common_types.DummyIdent(name="CreateMolluscRequest") + ) ) @@ -915,6 +944,35 @@ def test_render_method_call_basic_async(): ) +def test_render_method_call_basic_async(): + check_template( + ''' + {% import "feature_fragments.j2" as frags %} + {{ frags.render_method_call({"rpc": "CategorizeMollusc", "request": request}, + calling_form, calling_form_enum, transport) }} + ''', + ''' + await client.categorize_mollusc(request=request) + ''', + request=samplegen.FullRequest( + request_list=[ + samplegen.TransformedRequest(base="video", + body=True, + single=None), + samplegen.TransformedRequest(base="audio", + body=True, + single=None), + samplegen.TransformedRequest(base="guess", + body=True, + single=None) + ], + ), + calling_form_enum=CallingForm, + calling_form=CallingForm.Request, + transport="grpc-async" + ) + + def test_render_method_call_basic_flattenable(): check_template( ''' diff --git a/tests/unit/schema/wrappers/test_field.py b/tests/unit/schema/wrappers/test_field.py index 99f2edc9f7..2fa2c09783 100644 --- a/tests/unit/schema/wrappers/test_field.py +++ b/tests/unit/schema/wrappers/test_field.py @@ -17,6 +17,7 @@ import pytest from google.api import field_behavior_pb2 +from google.api import resource_pb2 from google.protobuf import descriptor_pb2 from gapic.schema import api @@ -108,6 +109,13 @@ def test_ident_sphinx_repeated(): assert field.ident.sphinx == 'Sequence[bool]' +def test_resource_reference(): + field = make_field(type='TYPE_STRING') + field.options.Extensions[resource_pb2.resource_reference].type = "translate.googleapis.com/Glossary" + + assert field.resource_reference == "translate.googleapis.com/Glossary" + + def test_type_primitives(): assert make_field(type='TYPE_FLOAT').type.python_type == float assert make_field(type='TYPE_INT64').type.python_type == int @@ -154,6 +162,11 @@ def test_mock_value_int(): assert field.mock_value == '728' +def test_mock_value_original_type_int(): + field = make_field(name='foo_bar', type='TYPE_INT32') + assert field.mock_value_original_type == 728 + + def test_oneof(): REP = descriptor_pb2.FieldDescriptorProto.Label.Value('LABEL_REPEATED') @@ -166,26 +179,51 @@ def test_mock_value_float(): assert field.mock_value == '0.728' +def test_mock_value_original_type_float(): + field = make_field(name='foo_bar', type='TYPE_DOUBLE') + assert field.mock_value_original_type == 0.728 + + def test_mock_value_bool(): field = make_field(name='foo_bar', type='TYPE_BOOL') assert field.mock_value == 'True' +def test_mock_value_original_type_bool(): + field = make_field(name='foo_bar', type='TYPE_BOOL') + assert field.mock_value_original_type == True + + def test_mock_value_str(): field = make_field(name='foo_bar', type='TYPE_STRING') assert field.mock_value == "'foo_bar_value'" +def test_mock_value_original_type_str(): + field = make_field(name='foo_bar', type='TYPE_STRING') + assert field.mock_value_original_type == "foo_bar_value" + + def test_mock_value_bytes(): field = make_field(name='foo_bar', type='TYPE_BYTES') assert field.mock_value == "b'foo_bar_blob'" +def test_mock_value_original_type_bytes(): + field = make_field(name='foo_bar', type='TYPE_BYTES') + assert field.mock_value_original_type == b"foo_bar_blob" + + def test_mock_value_repeated(): field = make_field(name='foo_bar', type='TYPE_STRING', label=3) assert field.mock_value == "['foo_bar_value']" +def test_mock_value_original_type_repeated(): + field = make_field(name='foo_bar', type='TYPE_STRING', label=3) + assert field.mock_value_original_type == ["foo_bar_value"] + + def test_mock_value_map(): entry_msg = make_message( name='SquidEntry', @@ -251,6 +289,33 @@ def test_mock_value_message(): assert field.mock_value == 'bogus.Message(foo=324)' +def test_mock_value_original_type_message_errors(): + subfields = collections.OrderedDict(( + ('foo', make_field(name='foo', type='TYPE_INT32')), + ('bar', make_field(name='bar', type='TYPE_STRING')) + )) + message = wrappers.MessageType( + fields=subfields, + message_pb=descriptor_pb2.DescriptorProto(name='Message', field=[ + i.field_pb for i in subfields.values() + ]), + meta=metadata.Metadata(address=metadata.Address( + module='bogus', + name='Message', + )), + nested_enums={}, + nested_messages={}, + ) + field = make_field( + type='TYPE_MESSAGE', + type_name='bogus.Message', + message=message, + ) + + with pytest.raises(TypeError): + mock = field.mock_value_original_type + + def test_mock_value_recursive(): # The elaborate setup is an unfortunate requirement. file_pb = descriptor_pb2.FileDescriptorProto( @@ -290,3 +355,7 @@ def test_field_name_kword_disambiguation(): name="frum", ) assert frum_field.name == "frum" + + +def test_field_resource_reference(): + field = make_field(name='parent', type='TYPE_STRING') diff --git a/tests/unit/schema/wrappers/test_message.py b/tests/unit/schema/wrappers/test_message.py index 3de69d3e54..f0b5d61166 100644 --- a/tests/unit/schema/wrappers/test_message.py +++ b/tests/unit/schema/wrappers/test_message.py @@ -18,6 +18,7 @@ import pytest +from google.api import field_behavior_pb2 from google.api import resource_pb2 from google.protobuf import descriptor_pb2 @@ -275,3 +276,34 @@ def test_oneof_fields(): "mass": [mass_kg, mass_lbs], "length": [length_m, length_f], } + assert actual_oneofs == expected_oneofs + + +def test_required_fields(): + REQUIRED = field_behavior_pb2.FieldBehavior.Value('REQUIRED') + + mass_kg = make_field(name="mass_kg", type=5) + mass_kg.options.Extensions[field_behavior_pb2.field_behavior].append( + REQUIRED + ) + + length_m = make_field(name="length_m", type=5) + length_m.options.Extensions[field_behavior_pb2.field_behavior].append( + REQUIRED + ) + + color = make_field(name="color", type=5) + color.options.Extensions[field_behavior_pb2.field_behavior].append( + REQUIRED + ) + + request = make_message( + name="CreateMolluscReuqest", + fields=( + mass_kg, + length_m, + color, + ), + ) + + assert set(request.required_fields) == {mass_kg, length_m, color} diff --git a/tests/unit/schema/wrappers/test_service.py b/tests/unit/schema/wrappers/test_service.py index 9c47797daf..f93ddc814e 100644 --- a/tests/unit/schema/wrappers/test_service.py +++ b/tests/unit/schema/wrappers/test_service.py @@ -41,8 +41,10 @@ def make_resource_opts(*args): # Resources are labeled via an options extension opts = descriptor_pb2.MessageOptions() opts.Extensions[resource_pb2.resource].pattern.append( - "/".join("{{{arg}}}/{arg}" for arg in args) + "/".join(f"{arg}/{{{arg}}}" for arg in args) ) + opts.Extensions[resource_pb2.resource].type = "/".join( + f"{arg}/{{{arg}}}" for arg in args) return opts @@ -249,6 +251,87 @@ def test_resource_messages(): assert expected == actual +def test_resource_messages_dict(): + # Regular, top level resource + squid_resource = make_message("Squid", options=make_resource_opts("squid")) + squid_request = make_message( + "CreateSquid", + fields=( + make_field('squid', message=squid_resource), + ), + ) + + # Nested resource + squamosa_message = make_message( + "Squamosa", + options=make_resource_opts("clam", "squamosa"), + ) + clam_resource = make_message( + "Clam", + options=make_resource_opts("clam"), + fields=( + make_field('squamosa', message=squamosa_message), + ), + ) + clam_request = make_message( + 'CreateClam', + fields=( + make_field('clam', message=clam_resource), + # Red herring, not resources :) + make_field('zone', 2, enum=make_enum('Zone')), + make_field('pearls', 3, True, message=make_message('Pearl')), + ), + ) + + # Some special APIs have request messages that _are_ resources. + whelk_resource = make_message("Whelk", options=make_resource_opts("whelk")) + + # Not a resource + octopus_request = make_message( + "CreateOctopus", + fields=( + make_field('Octopus', message=make_message('Octopus')), + ), + ) + + service = make_service( + 'Molluscs', + methods=( + make_method( + f"{message.name}", + input_message=message, + ) + for message in ( + squid_request, + clam_request, + whelk_resource, + octopus_request, + ) + ) + ) + + expected = { + # Service specific + "squid/{squid}": squid_resource, + "clam/{clam}": clam_resource, + "whelk/{whelk}": whelk_resource, + "clam/{clam}/squamosa/{squamosa}": squamosa_message, + # Common resources + "cloudresourcemanager.googleapis.com/Project": + service.common_resources["cloudresourcemanager.googleapis.com/Project"].message_type, + "cloudresourcemanager.googleapis.com/Organization": + service.common_resources["cloudresourcemanager.googleapis.com/Organization"].message_type, + "cloudresourcemanager.googleapis.com/Folder": + service.common_resources["cloudresourcemanager.googleapis.com/Folder"].message_type, + "cloudbilling.googleapis.com/BillingAccount": + service.common_resources["cloudbilling.googleapis.com/BillingAccount"].message_type, + "locations.googleapis.com/Location": + service.common_resources["locations.googleapis.com/Location"].message_type + } + actual = service.resource_messages_dict + assert expected == actual + + def test_service_unknown_resource_reference(): # This happens occasionally. opts = descriptor_pb2.FieldOptions()