diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/_mixins.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/_mixins.py.j2 index 27f7000ae2..3179d8bbd9 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/_mixins.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/_mixins.py.j2 @@ -3,10 +3,10 @@ {% if "ListOperations" in api.mixin_api_methods %} def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -57,10 +57,10 @@ {% if "GetOperation" in api.mixin_api_methods %} def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -110,10 +110,10 @@ {% if "DeleteOperation" in api.mixin_api_methods %} def delete_operation( self, - request: operations_pb2.DeleteOperationRequest = None, + request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -163,10 +163,10 @@ {% if "CancelOperation" in api.mixin_api_methods %} def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -215,10 +215,10 @@ {% if "WaitOperation" in api.mixin_api_methods %} def wait_operation( self, - request: operations_pb2.WaitOperationRequest = None, + request: Optional[operations_pb2.WaitOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Waits until the specified long-running operation is done or reaches at most @@ -274,10 +274,10 @@ {% if "SetIamPolicy" in api.mixin_api_methods %} def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -393,10 +393,10 @@ {% if "GetIamPolicy" in api.mixin_api_methods %} def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -513,10 +513,10 @@ {% if "TestIamPermissions" in api.mixin_api_methods %} def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -575,10 +575,10 @@ {% if "GetLocation" in api.mixin_api_methods %} def get_location( self, - request: locations_pb2.GetLocationRequest = None, + request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -628,10 +628,10 @@ {% if "ListLocations" in api.mixin_api_methods %} def list_locations( self, - request: locations_pb2.ListLocationsRequest = None, + request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 index 29f0bd35c8..d0066988cb 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 @@ -5,7 +5,7 @@ from collections import OrderedDict import os import re -from typing import Callable, Dict, Mapping, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast +from typing import Callable, Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast import pkg_resources {% if service.any_deprecated %} import warnings @@ -68,7 +68,7 @@ class {{ service.client_name }}Meta(type): {% endif %} def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[{{ service.name }}Transport]: """Returns an appropriate transport class. @@ -218,7 +218,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, {{ service.name }}Transport, None] = None, + transport: Optional[Union[str, {{ service.name }}Transport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -230,7 +230,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, {{ service.name }}Transport]): The + transport (Optional[Union[str, {{ service.name }}Transport]]): The transport to use. If set to None, a transport is chosen automatically. {% if 'rest' in opts.transport and not opts.rest_numeric_enums %} @@ -340,17 +340,17 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): def {{ method.name|snake_case }}(self, {% endif %}{# Extended Operations LRO #} {% if not method.client_streaming %} - request: Union[{{ method.input.ident }}, dict] = None, + request: Optional[Union[{{ method.input.ident }}, dict]] = None, *, {% for field in method.flattened_fields.values() %} - {{ field.name }}: {{ field.ident }} = None, + {{ field.name }}: Optional[{{ field.ident }}] = None, {% endfor %} {% else %} - requests: Iterator[{{ method.input.ident }}] = None, + requests: Optional[Iterator[{{ method.input.ident }}]] = None, *, {% endif %} retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), {% if not method.server_streaming %} ) -> {{ method.client_output.ident }}: @@ -361,7 +361,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): Args: {% if not method.client_streaming %} - request (Union[{{ method.input.ident.sphinx }}, dict]): + request (Union[{{ method.input.ident.sphinx }}, dict, None]): The request object.{{ " " }} {{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }} {% for key, field in method.flattened_fields.items() %} @@ -516,10 +516,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): {% if opts.add_iam_methods %} def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -633,10 +633,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -750,10 +750,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/pagers.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/pagers.py.j2 index 9b99ad48f5..7be0c3a5c5 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/pagers.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/pagers.py.j2 @@ -78,7 +78,7 @@ class {{ method.name }}Pager: def get(self, key: str) -> Optional[{{ method.paged_result_field.type.fields.get('value').ident }}]: return self._response.{{ method.paged_result_field.name }}.get(key) {% else %} - def __iter__(self) -> {{ method.paged_result_field.ident | replace('Sequence', 'Iterator') }}: + def __iter__(self) -> {{ method.paged_result_field.ident | replace('MutableSequence', 'Iterator') }}: for page in self.pages: yield from page.{{ method.paged_result_field.name }} {% endif %} diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/base.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/base.py.j2 index 19f6f2f93b..f22a5dbe03 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/base.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/base.py.j2 @@ -58,7 +58,7 @@ class {{ service.name }}Transport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/grpc.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/grpc.py.j2 index b9d46f1cd7..374e6ddbc2 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/grpc.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/grpc.py.j2 @@ -51,14 +51,14 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport): def __init__(self, *, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -186,8 +186,8 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport): @classmethod def create_channel(cls, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 index b693f75303..ef32dbd4ae 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 @@ -140,15 +140,15 @@ class {{service.name}}RestTransport({{service.name}}Transport): {# TODO(yon-mg): handle mtls stuff if that is relevant for rest transport #} def __init__(self, *, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[{{ service.name }}RestInterceptor] = None, ) -> None: """Instantiate the transport. @@ -282,9 +282,9 @@ class {{service.name}}RestTransport({{service.name}}Transport): def __call__(self, request: {{method.input.ident}}, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ){% if not method.void %} -> {% if not method.server_streaming %}{{method.output.ident}}{% else %}rest_streaming.ResponseIterator{% endif %}{% endif %}: {% if method.http_options and not method.client_streaming %} r"""Call the {{- ' ' -}} diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 index c200027ac2..81a0755195 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 @@ -4,6 +4,8 @@ {% with p = proto.disambiguate('proto') %} {% if proto.messages|length or proto.all_enums|length %} +from typing import MutableMapping, MutableSequence + import proto{% if p != 'proto' %} as {{ p }}{% endif %} # type: ignore {% endif %} diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/types/_message.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/types/_message.py.j2 index 71ab95457a..320498ba21 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/types/_message.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/types/_message.py.j2 @@ -51,7 +51,7 @@ class {{ message.name }}({{ p }}.Message): {% for field in message.fields.values() %} {% if field.map %} {% with key_field = field.message.fields['key'], value_field = field.message.fields['value'] %} - {{ field.name }} = {{ p }}.MapField( + {{ field.name }}: MutableMapping[{{ key_field.type.ident.rel(message.ident) }}, {{ value_field.type.ident.rel(message.ident) }}] = {{ p }}.MapField( {{ p }}.{{ key_field.proto_type }}, {{ p }}.{{ value_field.proto_type }}, number={{ field.number }}, @@ -61,7 +61,7 @@ class {{ message.name }}({{ p }}.Message): ) {% endwith %} {% else %} - {{ field.name }} = {{ p }}.{% if field.repeated %}Repeated{% endif %}Field( + {{ field.name }}: {% if field.is_primitive %}{{ field.ident }}{% else %}{% if field.repeated %}MutableSequence[{% endif %}{{ field.type.ident.rel(message.ident) }}{% if field.repeated %}]{% endif %}{% endif %} = {{ p }}.{% if field.repeated %}Repeated{% endif %}Field( {{ p }}.{{ field.proto_type }}, number={{ field.number }}, {% if field.proto3_optional %} diff --git a/gapic/generator/generator.py b/gapic/generator/generator.py index 3b4884156a..541e1ab61b 100644 --- a/gapic/generator/generator.py +++ b/gapic/generator/generator.py @@ -19,7 +19,7 @@ import os import pathlib import typing -from typing import Any, DefaultDict, Dict, Mapping, Tuple +from typing import Any, DefaultDict, Dict, Mapping, Optional, Tuple from hashlib import sha256 from collections import OrderedDict, defaultdict from gapic.samplegen_utils.utils import coerce_response_name, is_valid_sample_cfg, render_format_string @@ -362,7 +362,7 @@ def _get_file( return {fn: cgr_file} def _get_filename( - self, template_name: str, *, api_schema: api.API, context: dict = None, + self, template_name: str, *, api_schema: api.API, context: Optional[dict] = None, ) -> str: """Return the appropriate output filename for this template. diff --git a/gapic/samplegen/manifest.py b/gapic/samplegen/manifest.py index b56b0159f2..47727e08ef 100644 --- a/gapic/samplegen/manifest.py +++ b/gapic/samplegen/manifest.py @@ -14,7 +14,7 @@ import os import time -from typing import Tuple +from typing import Optional, Tuple from gapic.samplegen_utils import (types, yaml) from gapic.utils import case @@ -45,7 +45,7 @@ def generate( api_schema, *, environment: yaml.Map = PYTHON3_ENVIRONMENT, - manifest_time: int = None + manifest_time: Optional[int] = None ) -> Tuple[str, yaml.Doc]: """Generate a samplegen manifest for use by sampletest diff --git a/gapic/schema/api.py b/gapic/schema/api.py index 19e1746347..b9af9e348a 100644 --- a/gapic/schema/api.py +++ b/gapic/schema/api.py @@ -81,7 +81,7 @@ def build( file_to_generate: bool, naming: api_naming.Naming, opts: Options = Options(), - prior_protos: Mapping[str, 'Proto'] = None, + prior_protos: Optional[Mapping[str, 'Proto']] = None, load_services: bool = True, all_resources: Optional[Mapping[str, wrappers.MessageType]] = None, ) -> 'Proto': @@ -243,7 +243,7 @@ def build( file_descriptors: Sequence[descriptor_pb2.FileDescriptorProto], package: str = '', opts: Options = Options(), - prior_protos: Mapping[str, 'Proto'] = None, + prior_protos: Optional[Mapping[str, 'Proto']] = None, ) -> 'API': """Build the internal API schema based on the request. @@ -631,7 +631,7 @@ def __init__( file_to_generate: bool, naming: api_naming.Naming, opts: Options = Options(), - prior_protos: Mapping[str, Proto] = None, + prior_protos: Optional[Mapping[str, Proto]] = None, load_services: bool = True, all_resources: Optional[Mapping[str, wrappers.MessageType]] = None, ): diff --git a/gapic/schema/metadata.py b/gapic/schema/metadata.py index d53c002e67..8dc4d5dc67 100644 --- a/gapic/schema/metadata.py +++ b/gapic/schema/metadata.py @@ -370,15 +370,15 @@ class FieldIdentifier: def __str__(self) -> str: if self.mapping: - return f'Mapping[{self.mapping[0].ident}, {self.mapping[1].ident}]' + return f'MutableMapping[{self.mapping[0].ident}, {self.mapping[1].ident}]' if self.repeated: - return f'Sequence[{self.ident}]' + return f'MutableSequence[{self.ident}]' return str(self.ident) @property def sphinx(self) -> str: if self.mapping: - return f'Mapping[{self.mapping[0].ident.sphinx}, {self.mapping[1].ident.sphinx}]' + return f'MutableMapping[{self.mapping[0].ident.sphinx}, {self.mapping[1].ident.sphinx}]' if self.repeated: - return f'Sequence[{self.ident.sphinx}]' + return f'MutableSequence[{self.ident.sphinx}]' return self.ident.sphinx diff --git a/gapic/schema/wrappers.py b/gapic/schema/wrappers.py index cf8690e592..4d9830d5c6 100644 --- a/gapic/schema/wrappers.py +++ b/gapic/schema/wrappers.py @@ -82,7 +82,7 @@ def name(self) -> str: @utils.cached_property def ident(self) -> metadata.FieldIdentifier: """Return the identifier to be used in templates.""" - mapping: Union[None, Tuple[Field, Field]] = None + mapping: Optional[Tuple[Field, Field]] = None if self.map: mapping = (self.type.fields["key"], self.type.fields["value"]) return metadata.FieldIdentifier( diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_async_mixins.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_async_mixins.py.j2 index b578108a17..0f1727f0de 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_async_mixins.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_async_mixins.py.j2 @@ -5,10 +5,10 @@ {% if "ListOperations" in api.mixin_api_methods %} async def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -59,10 +59,10 @@ {% if "GetOperation" in api.mixin_api_methods %} async def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -112,10 +112,10 @@ {% if "DeleteOperation" in api.mixin_api_methods %} async def delete_operation( self, - request: operations_pb2.DeleteOperationRequest = None, + request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -165,10 +165,10 @@ {% if "CancelOperation" in api.mixin_api_methods %} async def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -217,10 +217,10 @@ {% if "WaitOperation" in api.mixin_api_methods %} async def wait_operation( self, - request: operations_pb2.WaitOperationRequest = None, + request: Optional[operations_pb2.WaitOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Waits until the specified long-running operation is done or reaches at most @@ -281,10 +281,10 @@ {% if "SetIamPolicy" in api.mixin_api_methods %} async def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -400,10 +400,10 @@ {% if "GetIamPolicy" in api.mixin_api_methods %} async def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -520,10 +520,10 @@ {% if "TestIamPermissions" in api.mixin_api_methods %} async def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -582,10 +582,10 @@ {% if "GetLocation" in api.mixin_api_methods %} async def get_location( self, - request: locations_pb2.GetLocationRequest = None, + request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -635,10 +635,10 @@ {% if "ListLocations" in api.mixin_api_methods %} async def list_locations( self, - request: locations_pb2.ListLocationsRequest = None, + request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 index 705b921898..440d162b14 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 @@ -17,17 +17,17 @@ {% macro client_method(method, name, snippet_index, api, service, full_extended_lro=False) %} def {{ name }}(self, {% if not method.client_streaming %} - request: Union[{{ method.input.ident }}, dict] = None, + request: Optional[Union[{{ method.input.ident }}, dict]] = None, *, {% for field in method.flattened_fields.values() %} - {{ field.name }}: {{ field.ident }} = None, + {{ field.name }}: Optional[{{ field.ident }}] = None, {% endfor %} {% else %} - requests: Iterator[{{ method.input.ident }}] = None, + requests: Optional[Iterator[{{ method.input.ident }}]] = None, *, {% endif %} retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), {% if method.extended_lro and not full_extended_lro %}{# This is a hack to preserve backwards compatibility with the "unary" surfaces #} ) -> {{ method.extended_lro.operation_type.ident }}: diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_mixins.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_mixins.py.j2 index 6db4ca8a1b..ec1387acdd 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_mixins.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_mixins.py.j2 @@ -3,10 +3,10 @@ {% if "ListOperations" in api.mixin_api_methods %} def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -57,10 +57,10 @@ {% if "GetOperation" in api.mixin_api_methods %} def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -110,10 +110,10 @@ {% if "DeleteOperation" in api.mixin_api_methods %} def delete_operation( self, - request: operations_pb2.DeleteOperationRequest = None, + request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -163,10 +163,10 @@ {% if "CancelOperation" in api.mixin_api_methods %} def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -215,10 +215,10 @@ {% if "WaitOperation" in api.mixin_api_methods %} def wait_operation( self, - request: operations_pb2.WaitOperationRequest = None, + request: Optional[operations_pb2.WaitOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Waits until the specified long-running operation is done or reaches at most @@ -279,10 +279,10 @@ {% if "SetIamPolicy" in api.mixin_api_methods %} def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -398,10 +398,10 @@ {% if "GetIamPolicy" in api.mixin_api_methods %} def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -518,10 +518,10 @@ {% if "TestIamPermissions" in api.mixin_api_methods %} def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -580,10 +580,10 @@ {% if "GetLocation" in api.mixin_api_methods %} def get_location( self, - request: locations_pb2.GetLocationRequest = None, + request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -633,10 +633,10 @@ {% if "ListLocations" in api.mixin_api_methods %} def list_locations( self, - request: locations_pb2.ListLocationsRequest = None, + request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 3d3b29f400..88b142dd60 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -5,7 +5,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, {% if service.any_server_streaming %}AsyncIterable, Awaitable, {% endif %}{% if service.any_client_streaming %}AsyncIterator, {% endif %}Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}AsyncIterable, Awaitable, {% endif %}{% if service.any_client_streaming %}AsyncIterator, {% endif %}Sequence, Tuple, Type, Union import pkg_resources {% if service.any_deprecated %} import warnings @@ -144,9 +144,9 @@ class {{ service.async_client_name }}: get_transport_class = functools.partial(type({{ service.client_name }}).get_transport_class, type({{ service.client_name }})) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, {{ service.name }}Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the {{ (service.client_name|snake_case).replace("_", " ") }}. @@ -195,17 +195,17 @@ class {{ service.async_client_name }}: {%+ if not method.server_streaming %}async {% endif %}def {{ method_name }}(self, {% endwith %} {% if not method.client_streaming %} - request: Union[{{ method.input.ident }}, dict] = None, + request: Optional[Union[{{ method.input.ident }}, dict]] = None, *, {% for field in method.flattened_fields.values() %} - {{ field.name }}: {{ field.ident }} = None, + {{ field.name }}: Optional[{{ field.ident }}] = None, {% endfor %} {% else %} - requests: AsyncIterator[{{ method.input.ident }}] = None, + requests: Optional[AsyncIterator[{{ method.input.ident }}]] = None, *, {% endif %} retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), {% if not method.server_streaming %} ) -> {{ method.client_output_async.ident }}: @@ -224,7 +224,7 @@ class {{ service.async_client_name }}: Args: {% if not method.client_streaming %} - request (Union[{{ method.input.ident.sphinx }}, dict]): + request (Optional[Union[{{ method.input.ident.sphinx }}, dict]]): The request object.{{ " " }} {{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }} {% for key, field in method.flattened_fields.items() %} @@ -387,10 +387,10 @@ class {{ service.async_client_name }}: {% if opts.add_iam_methods %} async def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -501,10 +501,10 @@ class {{ service.async_client_name }}: async def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -617,10 +617,10 @@ class {{ service.async_client_name }}: async def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified permissions against the IAM access control diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 index c19e3bb9b2..d7667abd1f 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 @@ -9,7 +9,7 @@ import functools {% endif %} import os import re -from typing import Dict, Mapping, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast import pkg_resources {% if service.any_deprecated %} import warnings @@ -78,7 +78,7 @@ class {{ service.client_name }}Meta(type): {% endif %} def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[{{ service.name }}Transport]: """Returns an appropriate transport class. @@ -275,7 +275,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, {{ service.name }}Transport, None] = None, + transport: Optional[Union[str, {{ service.name }}Transport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -396,10 +396,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): {% if opts.add_iam_methods %} def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -513,10 +513,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -631,10 +631,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/pagers.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/pagers.py.j2 index cc8d34921e..fc3aa4f44c 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/pagers.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/pagers.py.j2 @@ -80,7 +80,7 @@ class {{ method.name }}Pager: def get(self, key: str) -> Optional[{{ method.paged_result_field.type.fields.get('value').ident }}]: return self._response.{{ method.paged_result_field.name }}.get(key) {% else %} - def __iter__(self) -> {{ method.paged_result_field.ident | replace('Sequence', 'Iterator') }}: + def __iter__(self) -> {{ method.paged_result_field.ident | replace('MutableSequence', 'Iterator') }}: for page in self.pages: yield from page.{{ method.paged_result_field.name }} {% endif %} @@ -154,7 +154,7 @@ class {{ method.name }}AsyncPager: return self._response.{{ method.paged_result_field.name }}.get(key) {% else %} - def __aiter__(self) -> {{ method.paged_result_field.ident | replace('Sequence', 'AsyncIterator') }}: + def __aiter__(self) -> {{ method.paged_result_field.ident | replace('MutableSequence', 'AsyncIterator') }}: async def async_generator(): async for page in self.pages: for response in page.{{ method.paged_result_field.name }}: diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/_rest_mixins.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/_rest_mixins.py.j2 index 3bf58c3c75..4dee95ceca 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/_rest_mixins.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/_rest_mixins.py.j2 @@ -8,9 +8,9 @@ class _{{ name }}({{service.name}}RestStub): def __call__(self, request: {{ sig.request_type }}, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> {{ sig.response_type }}: r"""Call the {{- ' ' -}} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2 index bfca9d9900..5078178439 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2 @@ -63,7 +63,7 @@ class {{ service.name }}Transport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc.py.j2 index 0e0ada4542..96923c5dbd 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc.py.j2 @@ -51,14 +51,14 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport): def __init__(self, *, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -188,8 +188,8 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport): @classmethod def create_channel(cls, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc_asyncio.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc_asyncio.py.j2 index d47e3eee63..25b7b4db5c 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc_asyncio.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc_asyncio.py.j2 @@ -55,7 +55,7 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport): @classmethod def create_channel(cls, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -95,15 +95,15 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport): def __init__(self, *, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 index db5eaaf120..126d6e00a6 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 @@ -174,15 +174,15 @@ class {{service.name}}RestTransport({{service.name}}Transport): {# TODO(yon-mg): handle mtls stuff if that is relevant for rest transport #} def __init__(self, *, host: str{% if service.host %} = '{{ service.host }}'{% endif %}, - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[{{ service.name }}RestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -318,9 +318,9 @@ class {{service.name}}RestTransport({{service.name}}Transport): def __call__(self, request: {{method.input.ident}}, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ){% if not method.void %} -> {% if not method.server_streaming %}{{method.output.ident}}{% else %}rest_streaming.ResponseIterator{% endif %}{% endif %}: {% if method.http_options and not method.client_streaming %} r"""Call the {{- ' ' -}} diff --git a/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 index f4e4be617d..f5aebf7364 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 @@ -4,6 +4,8 @@ {% with p = proto.disambiguate('proto') %} {% if proto.messages|length or proto.all_enums|length %} +from typing import MutableMapping, MutableSequence + import proto{% if p != 'proto' %} as {{ p }}{% endif %} # type: ignore {% endif %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/types/_message.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/types/_message.py.j2 index b6e93cefcb..31b6e795aa 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/types/_message.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/types/_message.py.j2 @@ -51,7 +51,7 @@ class {{ message.name }}({{ p }}.Message): {% for field in message.fields.values() %} {% if field.map %} {% with key_field = field.message.fields['key'], value_field = field.message.fields['value'] %} - {{ field.name }} = {{ p }}.MapField( + {{ field.name }}: MutableMapping[{{ key_field.type.ident.rel(message.ident) }}, {{ value_field.type.ident.rel(message.ident) }}] = {{ p }}.MapField( {{ p }}.{{ key_field.proto_type }}, {{ p }}.{{ value_field.proto_type }}, number={{ field.number }}, @@ -61,7 +61,7 @@ class {{ message.name }}({{ p }}.Message): ) {% endwith %} {% else %}{# field.map #} - {{ field.name }} = {{ p }}.{% if field.repeated %}Repeated{% endif %}Field( + {{ field.name }}: {% if field.is_primitive %}{{ field.ident }}{% else %}{% if field.repeated %}MutableSequence[{% endif %}{{ field.type.ident.rel(message.ident) }}{% if field.repeated %}]{% endif %}{% endif %} = {{ p }}.{% if field.repeated %}Repeated{% endif %}Field( {{ p }}.{{ field.proto_type }}, number={{ field.number }}, {% if field.proto3_optional %} diff --git a/gapic/utils/lines.py b/gapic/utils/lines.py index 4e268f284e..9e66a88ae9 100644 --- a/gapic/utils/lines.py +++ b/gapic/utils/lines.py @@ -13,7 +13,7 @@ # limitations under the License. import textwrap -from typing import Iterable +from typing import Iterable, Optional def sort_lines(text: str, dedupe: bool = True) -> str: @@ -39,7 +39,7 @@ def sort_lines(text: str, dedupe: bool = True) -> str: return f'{leading}{answer}{trailing}' -def wrap(text: str, width: int, *, offset: int = None, indent: int = 0) -> str: +def wrap(text: str, width: int, *, offset: Optional[int] = None, indent: int = 0) -> str: """Wrap the given string to the given width. This uses :meth:`textwrap.fill` under the hood, but provides useful diff --git a/gapic/utils/rst.py b/gapic/utils/rst.py index e9a76956a4..dc4912547c 100644 --- a/gapic/utils/rst.py +++ b/gapic/utils/rst.py @@ -13,13 +13,14 @@ # limitations under the License. import re +from typing import Optional import pypandoc # type: ignore from gapic.utils.lines import wrap -def rst(text: str, width: int = 72, indent: int = 0, nl: bool = None, +def rst(text: str, width: int = 72, indent: int = 0, nl: Optional[bool] = None, source_format: str = 'commonmark'): """Convert the given text to ReStructured Text. diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py index 28f1cf2148..977b03e887 100755 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -144,9 +144,9 @@ def transport(self) -> AssetServiceTransport: get_transport_class = functools.partial(type(AssetServiceClient).get_transport_class, type(AssetServiceClient)) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AssetServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the asset service client. @@ -190,10 +190,10 @@ def __init__(self, *, ) async def export_assets(self, - request: Union[asset_service.ExportAssetsRequest, dict] = None, + request: Optional[Union[asset_service.ExportAssetsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Exports assets with time and resource types to a given Cloud @@ -245,7 +245,7 @@ async def sample_export_assets(): print(response) Args: - request (Union[google.cloud.asset_v1.types.ExportAssetsRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.ExportAssetsRequest, dict]]): The request object. Export asset request. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -303,11 +303,11 @@ async def sample_export_assets(): return response async def list_assets(self, - request: Union[asset_service.ListAssetsRequest, dict] = None, + request: Optional[Union[asset_service.ListAssetsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAssetsAsyncPager: r"""Lists assets with time and resource types and returns @@ -341,7 +341,7 @@ async def sample_list_assets(): print(response) Args: - request (Union[google.cloud.asset_v1.types.ListAssetsRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.ListAssetsRequest, dict]]): The request object. ListAssets request. parent (:class:`str`): Required. Name of the organization or project the assets @@ -419,10 +419,10 @@ async def sample_list_assets(): return response async def batch_get_assets_history(self, - request: Union[asset_service.BatchGetAssetsHistoryRequest, dict] = None, + request: Optional[Union[asset_service.BatchGetAssetsHistoryRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.BatchGetAssetsHistoryResponse: r"""Batch gets the update history of assets that overlap a time @@ -460,7 +460,7 @@ async def sample_batch_get_assets_history(): print(response) Args: - request (Union[google.cloud.asset_v1.types.BatchGetAssetsHistoryRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.BatchGetAssetsHistoryRequest, dict]]): The request object. Batch get assets history request. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -510,11 +510,11 @@ async def sample_batch_get_assets_history(): return response async def create_feed(self, - request: Union[asset_service.CreateFeedRequest, dict] = None, + request: Optional[Union[asset_service.CreateFeedRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Creates a feed in a parent @@ -553,7 +553,7 @@ async def sample_create_feed(): print(response) Args: - request (Union[google.cloud.asset_v1.types.CreateFeedRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.CreateFeedRequest, dict]]): The request object. Create asset feed request. parent (:class:`str`): Required. The name of the @@ -629,11 +629,11 @@ async def sample_create_feed(): return response async def get_feed(self, - request: Union[asset_service.GetFeedRequest, dict] = None, + request: Optional[Union[asset_service.GetFeedRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Gets details about an asset feed. @@ -665,7 +665,7 @@ async def sample_get_feed(): print(response) Args: - request (Union[google.cloud.asset_v1.types.GetFeedRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.GetFeedRequest, dict]]): The request object. Get asset feed request. name (:class:`str`): Required. The name of the Feed and it must be in the @@ -743,11 +743,11 @@ async def sample_get_feed(): return response async def list_feeds(self, - request: Union[asset_service.ListFeedsRequest, dict] = None, + request: Optional[Union[asset_service.ListFeedsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.ListFeedsResponse: r"""Lists all asset feeds in a parent @@ -780,7 +780,7 @@ async def sample_list_feeds(): print(response) Args: - request (Union[google.cloud.asset_v1.types.ListFeedsRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.ListFeedsRequest, dict]]): The request object. List asset feeds request. parent (:class:`str`): Required. The parent @@ -853,11 +853,11 @@ async def sample_list_feeds(): return response async def update_feed(self, - request: Union[asset_service.UpdateFeedRequest, dict] = None, + request: Optional[Union[asset_service.UpdateFeedRequest, dict]] = None, *, - feed: asset_service.Feed = None, + feed: Optional[asset_service.Feed] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Updates an asset feed configuration. @@ -892,7 +892,7 @@ async def sample_update_feed(): print(response) Args: - request (Union[google.cloud.asset_v1.types.UpdateFeedRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.UpdateFeedRequest, dict]]): The request object. Update asset feed request. feed (:class:`google.cloud.asset_v1.types.Feed`): Required. The new values of feed details. It must match @@ -964,11 +964,11 @@ async def sample_update_feed(): return response async def delete_feed(self, - request: Union[asset_service.DeleteFeedRequest, dict] = None, + request: Optional[Union[asset_service.DeleteFeedRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an asset feed. @@ -997,7 +997,7 @@ async def sample_delete_feed(): await client.delete_feed(request=request) Args: - request (Union[google.cloud.asset_v1.types.DeleteFeedRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.DeleteFeedRequest, dict]]): The request object. name (:class:`str`): Required. The name of the feed and it must be in the @@ -1061,13 +1061,13 @@ async def sample_delete_feed(): ) async def search_all_resources(self, - request: Union[asset_service.SearchAllResourcesRequest, dict] = None, + request: Optional[Union[asset_service.SearchAllResourcesRequest, dict]] = None, *, - scope: str = None, - query: str = None, - asset_types: Sequence[str] = None, + scope: Optional[str] = None, + query: Optional[str] = None, + asset_types: Optional[MutableSequence[str]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchAllResourcesAsyncPager: r"""Searches all Cloud resources within the specified scope, such as @@ -1103,7 +1103,7 @@ async def sample_search_all_resources(): print(response) Args: - request (Union[google.cloud.asset_v1.types.SearchAllResourcesRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.SearchAllResourcesRequest, dict]]): The request object. Search all resources request. scope (:class:`str`): Required. A scope can be a project, a folder, or an @@ -1175,7 +1175,7 @@ async def sample_search_all_resources(): This corresponds to the ``query`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - asset_types (:class:`Sequence[str]`): + asset_types (:class:`MutableSequence[str]`): Optional. A list of asset types that this request searches for. If empty, it will search all the `searchable asset @@ -1275,12 +1275,12 @@ async def sample_search_all_resources(): return response async def search_all_iam_policies(self, - request: Union[asset_service.SearchAllIamPoliciesRequest, dict] = None, + request: Optional[Union[asset_service.SearchAllIamPoliciesRequest, dict]] = None, *, - scope: str = None, - query: str = None, + scope: Optional[str] = None, + query: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchAllIamPoliciesAsyncPager: r"""Searches all IAM policies within the specified scope, such as a @@ -1316,7 +1316,7 @@ async def sample_search_all_iam_policies(): print(response) Args: - request (Union[google.cloud.asset_v1.types.SearchAllIamPoliciesRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.SearchAllIamPoliciesRequest, dict]]): The request object. Search all IAM policies request. scope (:class:`str`): Required. A scope can be a project, a folder, or an @@ -1468,10 +1468,10 @@ async def sample_search_all_iam_policies(): return response async def analyze_iam_policy(self, - request: Union[asset_service.AnalyzeIamPolicyRequest, dict] = None, + request: Optional[Union[asset_service.AnalyzeIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.AnalyzeIamPolicyResponse: r"""Analyzes IAM policies to answer which identities have @@ -1507,7 +1507,7 @@ async def sample_analyze_iam_policy(): print(response) Args: - request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.AnalyzeIamPolicyRequest, dict]]): The request object. A request message for [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1559,10 +1559,10 @@ async def sample_analyze_iam_policy(): return response async def analyze_iam_policy_longrunning(self, - request: Union[asset_service.AnalyzeIamPolicyLongrunningRequest, dict] = None, + request: Optional[Union[asset_service.AnalyzeIamPolicyLongrunningRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Analyzes IAM policies asynchronously to answer which identities @@ -1616,7 +1616,7 @@ async def sample_analyze_iam_policy_longrunning(): print(response) Args: - request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyLongrunningRequest, dict]): + request (Optional[Union[google.cloud.asset_v1.types.AnalyzeIamPolicyLongrunningRequest, dict]]): The request object. A request message for [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py index 33d47f6b99..315906adf8 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast import pkg_resources from google.api_core import client_options as client_options_lib @@ -59,7 +59,7 @@ class AssetServiceClientMeta(type): _transport_registry["rest"] = AssetServiceRestTransport def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[AssetServiceTransport]: """Returns an appropriate transport class. @@ -303,7 +303,7 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, AssetServiceTransport, None] = None, + transport: Optional[Union[str, AssetServiceTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -393,10 +393,10 @@ def __init__(self, *, ) def export_assets(self, - request: Union[asset_service.ExportAssetsRequest, dict] = None, + request: Optional[Union[asset_service.ExportAssetsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Exports assets with time and resource types to a given Cloud @@ -507,11 +507,11 @@ def sample_export_assets(): return response def list_assets(self, - request: Union[asset_service.ListAssetsRequest, dict] = None, + request: Optional[Union[asset_service.ListAssetsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAssetsPager: r"""Lists assets with time and resource types and returns @@ -623,10 +623,10 @@ def sample_list_assets(): return response def batch_get_assets_history(self, - request: Union[asset_service.BatchGetAssetsHistoryRequest, dict] = None, + request: Optional[Union[asset_service.BatchGetAssetsHistoryRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.BatchGetAssetsHistoryResponse: r"""Batch gets the update history of assets that overlap a time @@ -708,11 +708,11 @@ def sample_batch_get_assets_history(): return response def create_feed(self, - request: Union[asset_service.CreateFeedRequest, dict] = None, + request: Optional[Union[asset_service.CreateFeedRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Creates a feed in a parent @@ -827,11 +827,11 @@ def sample_create_feed(): return response def get_feed(self, - request: Union[asset_service.GetFeedRequest, dict] = None, + request: Optional[Union[asset_service.GetFeedRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Gets details about an asset feed. @@ -934,11 +934,11 @@ def sample_get_feed(): return response def list_feeds(self, - request: Union[asset_service.ListFeedsRequest, dict] = None, + request: Optional[Union[asset_service.ListFeedsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.ListFeedsResponse: r"""Lists all asset feeds in a parent @@ -1037,11 +1037,11 @@ def sample_list_feeds(): return response def update_feed(self, - request: Union[asset_service.UpdateFeedRequest, dict] = None, + request: Optional[Union[asset_service.UpdateFeedRequest, dict]] = None, *, - feed: asset_service.Feed = None, + feed: Optional[asset_service.Feed] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Updates an asset feed configuration. @@ -1148,11 +1148,11 @@ def sample_update_feed(): return response def delete_feed(self, - request: Union[asset_service.DeleteFeedRequest, dict] = None, + request: Optional[Union[asset_service.DeleteFeedRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an asset feed. @@ -1238,13 +1238,13 @@ def sample_delete_feed(): ) def search_all_resources(self, - request: Union[asset_service.SearchAllResourcesRequest, dict] = None, + request: Optional[Union[asset_service.SearchAllResourcesRequest, dict]] = None, *, - scope: str = None, - query: str = None, - asset_types: Sequence[str] = None, + scope: Optional[str] = None, + query: Optional[str] = None, + asset_types: Optional[MutableSequence[str]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchAllResourcesPager: r"""Searches all Cloud resources within the specified scope, such as @@ -1352,7 +1352,7 @@ def sample_search_all_resources(): This corresponds to the ``query`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - asset_types (Sequence[str]): + asset_types (MutableSequence[str]): Optional. A list of asset types that this request searches for. If empty, it will search all the `searchable asset @@ -1445,12 +1445,12 @@ def sample_search_all_resources(): return response def search_all_iam_policies(self, - request: Union[asset_service.SearchAllIamPoliciesRequest, dict] = None, + request: Optional[Union[asset_service.SearchAllIamPoliciesRequest, dict]] = None, *, - scope: str = None, - query: str = None, + scope: Optional[str] = None, + query: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchAllIamPoliciesPager: r"""Searches all IAM policies within the specified scope, such as a @@ -1631,10 +1631,10 @@ def sample_search_all_iam_policies(): return response def analyze_iam_policy(self, - request: Union[asset_service.AnalyzeIamPolicyRequest, dict] = None, + request: Optional[Union[asset_service.AnalyzeIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.AnalyzeIamPolicyResponse: r"""Analyzes IAM policies to answer which identities have @@ -1717,10 +1717,10 @@ def sample_analyze_iam_policy(): return response def analyze_iam_policy_longrunning(self, - request: Union[asset_service.AnalyzeIamPolicyLongrunningRequest, dict] = None, + request: Optional[Union[asset_service.AnalyzeIamPolicyLongrunningRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Analyzes IAM policies asynchronously to answer which identities diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/base.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/base.py index 8a2127eeef..ad1d09b626 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/base.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/base.py @@ -51,7 +51,7 @@ class AssetServiceTransport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py index 340bd09b02..845421d5e2 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py @@ -47,14 +47,14 @@ class AssetServiceGrpcTransport(AssetServiceTransport): def __init__(self, *, host: str = 'cloudasset.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -181,8 +181,8 @@ def __init__(self, *, @classmethod def create_channel(cls, host: str = 'cloudasset.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc_asyncio.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc_asyncio.py index 00e15c96e2..d579bca88a 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc_asyncio.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/grpc_asyncio.py @@ -51,7 +51,7 @@ class AssetServiceGrpcAsyncIOTransport(AssetServiceTransport): @classmethod def create_channel(cls, host: str = 'cloudasset.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -91,15 +91,15 @@ def create_channel(cls, def __init__(self, *, host: str = 'cloudasset.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py index ddd8b7a9f4..eab4b8c229 100755 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py @@ -366,15 +366,15 @@ class AssetServiceRestTransport(AssetServiceTransport): def __init__(self, *, host: str = 'cloudasset.googleapis.com', - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[AssetServiceRestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -478,9 +478,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.AnalyzeIamPolicyRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.AnalyzeIamPolicyResponse: r"""Call the analyze iam policy method over HTTP. @@ -558,9 +558,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.AnalyzeIamPolicyLongrunningRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the analyze iam policy longrunning method over HTTP. @@ -647,9 +647,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.BatchGetAssetsHistoryRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.BatchGetAssetsHistoryResponse: r"""Call the batch get assets history method over HTTP. @@ -723,9 +723,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.CreateFeedRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Call the create feed method over HTTP. @@ -815,9 +815,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.DeleteFeedRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the delete feed method over HTTP. @@ -879,9 +879,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.ExportAssetsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the export assets method over HTTP. @@ -965,9 +965,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.GetFeedRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Call the get feed method over HTTP. @@ -1048,9 +1048,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.ListAssetsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.ListAssetsResponse: r"""Call the list assets method over HTTP. @@ -1124,9 +1124,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.ListFeedsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.ListFeedsResponse: r"""Call the list feeds method over HTTP. @@ -1200,9 +1200,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.SearchAllIamPoliciesRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.SearchAllIamPoliciesResponse: r"""Call the search all iam policies method over HTTP. @@ -1276,9 +1276,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.SearchAllResourcesRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.SearchAllResourcesResponse: r"""Call the search all resources method over HTTP. @@ -1352,9 +1352,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: asset_service.UpdateFeedRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> asset_service.Feed: r"""Call the update feed method over HTTP. diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/types/asset_service.py b/tests/integration/goldens/asset/google/cloud/asset_v1/types/asset_service.py index 787a6b307c..047032e1a0 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/types/asset_service.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/types/asset_service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.asset_v1.types import assets as gca_assets @@ -91,7 +93,7 @@ class ExportAssetsRequest(proto.Message): collection and indexing, there is a volatile window during which running the same query may get different results. - asset_types (Sequence[str]): + asset_types (MutableSequence[str]): A list of asset types to take a snapshot for. For example: "compute.googleapis.com/Disk". @@ -122,25 +124,25 @@ class ExportAssetsRequest(proto.Message): where the results will be output to. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - asset_types = proto.RepeatedField( + asset_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - content_type = proto.Field( + content_type: 'ContentType' = proto.Field( proto.ENUM, number=4, enum='ContentType', ) - output_config = proto.Field( + output_config: 'OutputConfig' = proto.Field( proto.MESSAGE, number=5, message='OutputConfig', @@ -169,17 +171,17 @@ class ExportAssetsResponse(proto.Message): it exceeds a single Google Cloud Storage object limit. """ - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - output_config = proto.Field( + output_config: 'OutputConfig' = proto.Field( proto.MESSAGE, number=2, message='OutputConfig', ) - output_result = proto.Field( + output_result: 'OutputResult' = proto.Field( proto.MESSAGE, number=3, message='OutputResult', @@ -205,7 +207,7 @@ class ListAssetsRequest(proto.Message): collection and indexing, there is a volatile window during which running the same query may get different results. - asset_types (Sequence[str]): + asset_types (MutableSequence[str]): A list of asset types to take a snapshot for. For example: "compute.googleapis.com/Disk". @@ -243,29 +245,29 @@ class ListAssetsRequest(proto.Message): of assets. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - asset_types = proto.RepeatedField( + asset_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - content_type = proto.Field( + content_type: 'ContentType' = proto.Field( proto.ENUM, number=4, enum='ContentType', ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=5, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=6, ) @@ -277,7 +279,7 @@ class ListAssetsResponse(proto.Message): Attributes: read_time (google.protobuf.timestamp_pb2.Timestamp): Time the snapshot was taken. - assets (Sequence[google.cloud.asset_v1.types.Asset]): + assets (MutableSequence[google.cloud.asset_v1.types.Asset]): Assets. next_page_token (str): Token to retrieve the next page of results. @@ -290,17 +292,17 @@ class ListAssetsResponse(proto.Message): def raw_page(self): return self - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - assets = proto.RepeatedField( + assets: MutableSequence[gca_assets.Asset] = proto.RepeatedField( proto.MESSAGE, number=2, message=gca_assets.Asset, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=3, ) @@ -316,7 +318,7 @@ class BatchGetAssetsHistoryRequest(proto.Message): (such as "organizations/123"), a project ID (such as "projects/my-project-id")", or a project number (such as "projects/12345"). - asset_names (Sequence[str]): + asset_names (MutableSequence[str]): A list of the full names of the assets. See: https://cloud.google.com/asset-inventory/docs/resource-name-format Example: @@ -338,20 +340,20 @@ class BatchGetAssetsHistoryRequest(proto.Message): whose time window overlap with read_time_window. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - asset_names = proto.RepeatedField( + asset_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - content_type = proto.Field( + content_type: 'ContentType' = proto.Field( proto.ENUM, number=3, enum='ContentType', ) - read_time_window = proto.Field( + read_time_window: gca_assets.TimeWindow = proto.Field( proto.MESSAGE, number=4, message=gca_assets.TimeWindow, @@ -362,11 +364,11 @@ class BatchGetAssetsHistoryResponse(proto.Message): r"""Batch get assets history response. Attributes: - assets (Sequence[google.cloud.asset_v1.types.TemporalAsset]): + assets (MutableSequence[google.cloud.asset_v1.types.TemporalAsset]): A list of assets with valid time windows. """ - assets = proto.RepeatedField( + assets: MutableSequence[gca_assets.TemporalAsset] = proto.RepeatedField( proto.MESSAGE, number=1, message=gca_assets.TemporalAsset, @@ -398,15 +400,15 @@ class CreateFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - feed_id = proto.Field( + feed_id: str = proto.Field( proto.STRING, number=2, ) - feed = proto.Field( + feed: 'Feed' = proto.Field( proto.MESSAGE, number=3, message='Feed', @@ -424,7 +426,7 @@ class GetFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -443,7 +445,7 @@ class ListFeedsRequest(proto.Message): "projects/my-project-id"). """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) @@ -453,11 +455,11 @@ class ListFeedsResponse(proto.Message): r""" Attributes: - feeds (Sequence[google.cloud.asset_v1.types.Feed]): + feeds (MutableSequence[google.cloud.asset_v1.types.Feed]): A list of feeds. """ - feeds = proto.RepeatedField( + feeds: MutableSequence['Feed'] = proto.RepeatedField( proto.MESSAGE, number=1, message='Feed', @@ -480,12 +482,12 @@ class UpdateFeedRequest(proto.Message): contain fields that are immutable or only set by the server. """ - feed = proto.Field( + feed: 'Feed' = proto.Field( proto.MESSAGE, number=1, message='Feed', ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -503,7 +505,7 @@ class DeleteFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -532,13 +534,13 @@ class OutputConfig(proto.Message): This field is a member of `oneof`_ ``destination``. """ - gcs_destination = proto.Field( + gcs_destination: 'GcsDestination' = proto.Field( proto.MESSAGE, number=1, oneof='destination', message='GcsDestination', ) - bigquery_destination = proto.Field( + bigquery_destination: 'BigQueryDestination' = proto.Field( proto.MESSAGE, number=2, oneof='destination', @@ -558,7 +560,7 @@ class OutputResult(proto.Message): This field is a member of `oneof`_ ``result``. """ - gcs_result = proto.Field( + gcs_result: 'GcsOutputResult' = proto.Field( proto.MESSAGE, number=1, oneof='result', @@ -570,12 +572,12 @@ class GcsOutputResult(proto.Message): r"""A Cloud Storage output result. Attributes: - uris (Sequence[str]): + uris (MutableSequence[str]): List of uris of the Cloud Storage objects. Example: "gs://bucket_name/object_name". """ - uris = proto.RepeatedField( + uris: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -619,12 +621,12 @@ class GcsDestination(proto.Message): This field is a member of `oneof`_ ``object_uri``. """ - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, oneof='object_uri', ) - uri_prefix = proto.Field( + uri_prefix: str = proto.Field( proto.STRING, number=2, oneof='object_uri', @@ -709,24 +711,24 @@ class BigQueryDestination(proto.Message): a table. """ - dataset = proto.Field( + dataset: str = proto.Field( proto.STRING, number=1, ) - table = proto.Field( + table: str = proto.Field( proto.STRING, number=2, ) - force = proto.Field( + force: bool = proto.Field( proto.BOOL, number=3, ) - partition_spec = proto.Field( + partition_spec: 'PartitionSpec' = proto.Field( proto.MESSAGE, number=4, message='PartitionSpec', ) - separate_tables_per_asset_type = proto.Field( + separate_tables_per_asset_type: bool = proto.Field( proto.BOOL, number=5, ) @@ -752,7 +754,7 @@ class PartitionKey(proto.Enum): READ_TIME = 1 REQUEST_TIME = 2 - partition_key = proto.Field( + partition_key: PartitionKey = proto.Field( proto.ENUM, number=1, enum=PartitionKey, @@ -768,7 +770,7 @@ class PubsubDestination(proto.Message): ``projects/PROJECT_ID/topics/TOPIC_ID``. """ - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=1, ) @@ -786,7 +788,7 @@ class FeedOutputConfig(proto.Message): This field is a member of `oneof`_ ``destination``. """ - pubsub_destination = proto.Field( + pubsub_destination: 'PubsubDestination' = proto.Field( proto.MESSAGE, number=1, oneof='destination', @@ -812,7 +814,7 @@ class Feed(proto.Message): The client-assigned feed identifier must be unique within the parent project/folder/organization. - asset_names (Sequence[str]): + asset_names (MutableSequence[str]): A list of the full names of the assets to receive updates. You must specify either or both of asset_names and asset_types. Only asset updates matching specified @@ -822,7 +824,7 @@ class Feed(proto.Message): See `Resource Names `__ for more info. - asset_types (Sequence[str]): + asset_types (MutableSequence[str]): A list of types of the assets to receive updates. You must specify either or both of asset_names and asset_types. Only asset updates matching specified asset_names or asset_types @@ -855,29 +857,29 @@ class Feed(proto.Message): for detailed instructions. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - asset_names = proto.RepeatedField( + asset_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - asset_types = proto.RepeatedField( + asset_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - content_type = proto.Field( + content_type: 'ContentType' = proto.Field( proto.ENUM, number=4, enum='ContentType', ) - feed_output_config = proto.Field( + feed_output_config: 'FeedOutputConfig' = proto.Field( proto.MESSAGE, number=5, message='FeedOutputConfig', ) - condition = proto.Field( + condition: expr_pb2.Expr = proto.Field( proto.MESSAGE, number=6, message=expr_pb2.Expr, @@ -948,7 +950,7 @@ class SearchAllResourcesRequest(proto.Message): resources that contain "Important" as a word in any of the searchable fields and are also located in the "us-west1" region or the "global" location. - asset_types (Sequence[str]): + asset_types (MutableSequence[str]): Optional. A list of asset types that this request searches for. If empty, it will search all the `searchable asset types `__. @@ -1004,27 +1006,27 @@ class SearchAllResourcesRequest(proto.Message): ``additionalAttributes``) are not supported. """ - scope = proto.Field( + scope: str = proto.Field( proto.STRING, number=1, ) - query = proto.Field( + query: str = proto.Field( proto.STRING, number=2, ) - asset_types = proto.RepeatedField( + asset_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=4, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=5, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=6, ) @@ -1034,7 +1036,7 @@ class SearchAllResourcesResponse(proto.Message): r"""Search all resources response. Attributes: - results (Sequence[google.cloud.asset_v1.types.ResourceSearchResult]): + results (MutableSequence[google.cloud.asset_v1.types.ResourceSearchResult]): A list of Resources that match the search query. It contains the resource standard metadata information. @@ -1049,12 +1051,12 @@ class SearchAllResourcesResponse(proto.Message): def raw_page(self): return self - results = proto.RepeatedField( + results: MutableSequence[gca_assets.ResourceSearchResult] = proto.RepeatedField( proto.MESSAGE, number=1, message=gca_assets.ResourceSearchResult, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1138,7 +1140,7 @@ class SearchAllIamPoliciesRequest(proto.Message): be the value of ``next_page_token`` from the previous response. The values of all other method parameters must be identical to those in the previous call. - asset_types (Sequence[str]): + asset_types (MutableSequence[str]): Optional. A list of asset types that the IAM policies are attached to. If empty, it will search the IAM policies that are attached to all the `searchable asset @@ -1173,27 +1175,27 @@ class SearchAllIamPoliciesRequest(proto.Message): ``policy``) are not supported. """ - scope = proto.Field( + scope: str = proto.Field( proto.STRING, number=1, ) - query = proto.Field( + query: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) - asset_types = proto.RepeatedField( + asset_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=5, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=7, ) @@ -1203,7 +1205,7 @@ class SearchAllIamPoliciesResponse(proto.Message): r"""Search all IAM policies response. Attributes: - results (Sequence[google.cloud.asset_v1.types.IamPolicySearchResult]): + results (MutableSequence[google.cloud.asset_v1.types.IamPolicySearchResult]): A list of IamPolicy that match the search query. Related information such as the associated resource is returned along with the @@ -1218,12 +1220,12 @@ class SearchAllIamPoliciesResponse(proto.Message): def raw_page(self): return self - results = proto.RepeatedField( + results: MutableSequence[gca_assets.IamPolicySearchResult] = proto.RepeatedField( proto.MESSAGE, number=1, message=gca_assets.IamPolicySearchResult, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1276,7 +1278,7 @@ class ResourceSelector(proto.Message): types `__. """ - full_resource_name = proto.Field( + full_resource_name: str = proto.Field( proto.STRING, number=1, ) @@ -1301,7 +1303,7 @@ class IdentitySelector(proto.Message): supported. You must give a specific identity. """ - identity = proto.Field( + identity: str = proto.Field( proto.STRING, number=1, ) @@ -1314,18 +1316,18 @@ class AccessSelector(proto.Message): roles and permissions should be equal or less than 10. Attributes: - roles (Sequence[str]): + roles (MutableSequence[str]): Optional. The roles to appear in result. - permissions (Sequence[str]): + permissions (MutableSequence[str]): Optional. The permissions to appear in result. """ - roles = proto.RepeatedField( + roles: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - permissions = proto.RepeatedField( + permissions: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) @@ -1422,27 +1424,27 @@ class Options(proto.Message): Default is false. """ - expand_groups = proto.Field( + expand_groups: bool = proto.Field( proto.BOOL, number=1, ) - expand_roles = proto.Field( + expand_roles: bool = proto.Field( proto.BOOL, number=2, ) - expand_resources = proto.Field( + expand_resources: bool = proto.Field( proto.BOOL, number=3, ) - output_resource_edges = proto.Field( + output_resource_edges: bool = proto.Field( proto.BOOL, number=4, ) - output_group_edges = proto.Field( + output_group_edges: bool = proto.Field( proto.BOOL, number=5, ) - analyze_service_account_impersonation = proto.Field( + analyze_service_account_impersonation: bool = proto.Field( proto.BOOL, number=6, ) @@ -1462,38 +1464,38 @@ class ConditionContext(proto.Message): This field is a member of `oneof`_ ``TimeContext``. """ - access_time = proto.Field( + access_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, oneof='TimeContext', message=timestamp_pb2.Timestamp, ) - scope = proto.Field( + scope: str = proto.Field( proto.STRING, number=1, ) - resource_selector = proto.Field( + resource_selector: ResourceSelector = proto.Field( proto.MESSAGE, number=2, message=ResourceSelector, ) - identity_selector = proto.Field( + identity_selector: IdentitySelector = proto.Field( proto.MESSAGE, number=3, message=IdentitySelector, ) - access_selector = proto.Field( + access_selector: AccessSelector = proto.Field( proto.MESSAGE, number=4, message=AccessSelector, ) - options = proto.Field( + options: Options = proto.Field( proto.MESSAGE, number=5, message=Options, ) - condition_context = proto.Field( + condition_context: ConditionContext = proto.Field( proto.MESSAGE, number=6, message=ConditionContext, @@ -1522,12 +1524,12 @@ class AnalyzeIamPolicyRequest(proto.Message): Default is empty. """ - analysis_query = proto.Field( + analysis_query: 'IamPolicyAnalysisQuery' = proto.Field( proto.MESSAGE, number=1, message='IamPolicyAnalysisQuery', ) - execution_timeout = proto.Field( + execution_timeout: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=2, message=duration_pb2.Duration, @@ -1542,7 +1544,7 @@ class AnalyzeIamPolicyResponse(proto.Message): main_analysis (google.cloud.asset_v1.types.AnalyzeIamPolicyResponse.IamPolicyAnalysis): The main analysis that matches the original request. - service_account_impersonation_analysis (Sequence[google.cloud.asset_v1.types.AnalyzeIamPolicyResponse.IamPolicyAnalysis]): + service_account_impersonation_analysis (MutableSequence[google.cloud.asset_v1.types.AnalyzeIamPolicyResponse.IamPolicyAnalysis]): The service account impersonation analysis if [AnalyzeIamPolicyRequest.analyze_service_account_impersonation][] is enabled. @@ -1560,7 +1562,7 @@ class IamPolicyAnalysis(proto.Message): Attributes: analysis_query (google.cloud.asset_v1.types.IamPolicyAnalysisQuery): The analysis query. - analysis_results (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult]): + analysis_results (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult]): A list of [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult] that matches the analysis query, or empty if no result is @@ -1569,42 +1571,42 @@ class IamPolicyAnalysis(proto.Message): Represents whether all entries in the [analysis_results][google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results] have been fully explored to answer the query. - non_critical_errors (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisState]): + non_critical_errors (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisState]): A list of non-critical errors happened during the query handling. """ - analysis_query = proto.Field( + analysis_query: 'IamPolicyAnalysisQuery' = proto.Field( proto.MESSAGE, number=1, message='IamPolicyAnalysisQuery', ) - analysis_results = proto.RepeatedField( + analysis_results: MutableSequence[gca_assets.IamPolicyAnalysisResult] = proto.RepeatedField( proto.MESSAGE, number=2, message=gca_assets.IamPolicyAnalysisResult, ) - fully_explored = proto.Field( + fully_explored: bool = proto.Field( proto.BOOL, number=3, ) - non_critical_errors = proto.RepeatedField( + non_critical_errors: MutableSequence[gca_assets.IamPolicyAnalysisState] = proto.RepeatedField( proto.MESSAGE, number=5, message=gca_assets.IamPolicyAnalysisState, ) - main_analysis = proto.Field( + main_analysis: IamPolicyAnalysis = proto.Field( proto.MESSAGE, number=1, message=IamPolicyAnalysis, ) - service_account_impersonation_analysis = proto.RepeatedField( + service_account_impersonation_analysis: MutableSequence[IamPolicyAnalysis] = proto.RepeatedField( proto.MESSAGE, number=2, message=IamPolicyAnalysis, ) - fully_explored = proto.Field( + fully_explored: bool = proto.Field( proto.BOOL, number=3, ) @@ -1650,7 +1652,7 @@ class GcsDestination(proto.Message): it will be overwritten with the analysis result. """ - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, ) @@ -1708,31 +1710,31 @@ class PartitionKey(proto.Enum): PARTITION_KEY_UNSPECIFIED = 0 REQUEST_TIME = 1 - dataset = proto.Field( + dataset: str = proto.Field( proto.STRING, number=1, ) - table_prefix = proto.Field( + table_prefix: str = proto.Field( proto.STRING, number=2, ) - partition_key = proto.Field( + partition_key: 'IamPolicyAnalysisOutputConfig.BigQueryDestination.PartitionKey' = proto.Field( proto.ENUM, number=3, enum='IamPolicyAnalysisOutputConfig.BigQueryDestination.PartitionKey', ) - write_disposition = proto.Field( + write_disposition: str = proto.Field( proto.STRING, number=4, ) - gcs_destination = proto.Field( + gcs_destination: GcsDestination = proto.Field( proto.MESSAGE, number=1, oneof='destination', message=GcsDestination, ) - bigquery_destination = proto.Field( + bigquery_destination: BigQueryDestination = proto.Field( proto.MESSAGE, number=2, oneof='destination', @@ -1752,12 +1754,12 @@ class AnalyzeIamPolicyLongrunningRequest(proto.Message): where the results will be output to. """ - analysis_query = proto.Field( + analysis_query: 'IamPolicyAnalysisQuery' = proto.Field( proto.MESSAGE, number=1, message='IamPolicyAnalysisQuery', ) - output_config = proto.Field( + output_config: 'IamPolicyAnalysisOutputConfig' = proto.Field( proto.MESSAGE, number=2, message='IamPolicyAnalysisOutputConfig', diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/types/assets.py b/tests/integration/goldens/asset/google/cloud/asset_v1/types/assets.py index 4a4cdb8c56..55770d261e 100644 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/types/assets.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/types/assets.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.orgpolicy.v1 import orgpolicy_pb2 # type: ignore @@ -70,26 +72,26 @@ class PriorAssetState(proto.Enum): DOES_NOT_EXIST = 3 DELETED = 4 - window = proto.Field( + window: 'TimeWindow' = proto.Field( proto.MESSAGE, number=1, message='TimeWindow', ) - deleted = proto.Field( + deleted: bool = proto.Field( proto.BOOL, number=2, ) - asset = proto.Field( + asset: 'Asset' = proto.Field( proto.MESSAGE, number=3, message='Asset', ) - prior_asset_state = proto.Field( + prior_asset_state: PriorAssetState = proto.Field( proto.ENUM, number=4, enum=PriorAssetState, ) - prior_asset = proto.Field( + prior_asset: 'Asset' = proto.Field( proto.MESSAGE, number=5, message='Asset', @@ -108,12 +110,12 @@ class TimeWindow(proto.Message): instead. """ - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, @@ -170,7 +172,7 @@ class Asset(proto.Message): See `this topic `__ for more information. - org_policy (Sequence[google.cloud.orgpolicy.v1.orgpolicy_pb2.Policy]): + org_policy (MutableSequence[google.cloud.orgpolicy.v1.orgpolicy_pb2.Policy]): A representation of an `organization policy `__. There can be more than one organization policy with @@ -195,7 +197,7 @@ class Asset(proto.Message): `this topic `__ for more information. - ancestors (Sequence[str]): + ancestors (MutableSequence[str]): The ancestry path of an asset in Google Cloud `resource hierarchy `__, represented as a list of relative resource names. An @@ -208,58 +210,58 @@ class Asset(proto.Message): ``["projects/123456789", "folders/5432", "organizations/1234"]`` """ - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - asset_type = proto.Field( + asset_type: str = proto.Field( proto.STRING, number=2, ) - resource = proto.Field( + resource: 'Resource' = proto.Field( proto.MESSAGE, number=3, message='Resource', ) - iam_policy = proto.Field( + iam_policy: policy_pb2.Policy = proto.Field( proto.MESSAGE, number=4, message=policy_pb2.Policy, ) - org_policy = proto.RepeatedField( + org_policy: MutableSequence[orgpolicy_pb2.Policy] = proto.RepeatedField( proto.MESSAGE, number=6, message=orgpolicy_pb2.Policy, ) - access_policy = proto.Field( + access_policy: access_policy_pb2.AccessPolicy = proto.Field( proto.MESSAGE, number=7, oneof='access_context_policy', message=access_policy_pb2.AccessPolicy, ) - access_level = proto.Field( + access_level: access_level_pb2.AccessLevel = proto.Field( proto.MESSAGE, number=8, oneof='access_context_policy', message=access_level_pb2.AccessLevel, ) - service_perimeter = proto.Field( + service_perimeter: service_perimeter_pb2.ServicePerimeter = proto.Field( proto.MESSAGE, number=9, oneof='access_context_policy', message=service_perimeter_pb2.ServicePerimeter, ) - os_inventory = proto.Field( + os_inventory: inventory_pb2.Inventory = proto.Field( proto.MESSAGE, number=12, message=inventory_pb2.Inventory, ) - ancestors = proto.RepeatedField( + ancestors: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=10, ) @@ -314,32 +316,32 @@ class Resource(proto.Message): https://cloud.google.com/about/locations/. """ - version = proto.Field( + version: str = proto.Field( proto.STRING, number=1, ) - discovery_document_uri = proto.Field( + discovery_document_uri: str = proto.Field( proto.STRING, number=2, ) - discovery_name = proto.Field( + discovery_name: str = proto.Field( proto.STRING, number=3, ) - resource_url = proto.Field( + resource_url: str = proto.Field( proto.STRING, number=4, ) - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=5, ) - data = proto.Field( + data: struct_pb2.Struct = proto.Field( proto.MESSAGE, number=6, message=struct_pb2.Struct, ) - location = proto.Field( + location: str = proto.Field( proto.STRING, number=8, ) @@ -379,7 +381,7 @@ class ResourceSearchResult(proto.Message): - use a free text query. Example: ``12345`` - specify the ``scope`` field as this project in your search request. - folders (Sequence[str]): + folders (MutableSequence[str]): The folder(s) that this resource belongs to, in the form of folders/{FOLDER_NUMBER}. This field is available when the resource belongs to one or more folders. @@ -428,7 +430,7 @@ class ResourceSearchResult(proto.Message): - use a field query. Example: ``location:us-west*`` - use a free text query. Example: ``us-west*`` - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Labels associated with this resource. See `Labelling and grouping GCP resources `__ @@ -446,7 +448,7 @@ class ResourceSearchResult(proto.Message): ``labels.env:*`` - use a free text query. Example: ``prod`` - network_tags (Sequence[str]): + network_tags (MutableSequence[str]): Network tags associated with this resource. Like labels, network tags are a type of annotations used to group GCP resources. See `Labelling GCP @@ -564,75 +566,75 @@ class ResourceSearchResult(proto.Message): ``cloudresourcemanager.googleapis.com/Project`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - asset_type = proto.Field( + asset_type: str = proto.Field( proto.STRING, number=2, ) - project = proto.Field( + project: str = proto.Field( proto.STRING, number=3, ) - folders = proto.RepeatedField( + folders: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=17, ) - organization = proto.Field( + organization: str = proto.Field( proto.STRING, number=18, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=4, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=5, ) - location = proto.Field( + location: str = proto.Field( proto.STRING, number=6, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=7, ) - network_tags = proto.RepeatedField( + network_tags: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=8, ) - kms_key = proto.Field( + kms_key: str = proto.Field( proto.STRING, number=10, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=12, message=timestamp_pb2.Timestamp, ) - state = proto.Field( + state: str = proto.Field( proto.STRING, number=13, ) - additional_attributes = proto.Field( + additional_attributes: struct_pb2.Struct = proto.Field( proto.MESSAGE, number=9, message=struct_pb2.Struct, ) - parent_full_resource_name = proto.Field( + parent_full_resource_name: str = proto.Field( proto.STRING, number=19, ) - parent_asset_type = proto.Field( + parent_asset_type: str = proto.Field( proto.STRING, number=103, ) @@ -674,7 +676,7 @@ class IamPolicySearchResult(proto.Message): - specify the ``scope`` field as this project in your search request. - folders (Sequence[str]): + folders (MutableSequence[str]): The folder(s) that the IAM policy belongs to, in the form of folders/{FOLDER_NUMBER}. This field is available when the IAM policy belongs to one or more folders. @@ -724,7 +726,7 @@ class Explanation(proto.Message): r"""Explanation about the IAM policy search result. Attributes: - matched_permissions (Mapping[str, google.cloud.asset_v1.types.IamPolicySearchResult.Explanation.Permissions]): + matched_permissions (MutableMapping[str, google.cloud.asset_v1.types.IamPolicySearchResult.Explanation.Permissions]): The map from roles to their included permissions that match the permission query (i.e., a query containing ``policy.role.permissions:``). Example: if query @@ -741,49 +743,49 @@ class Permissions(proto.Message): r"""IAM permissions Attributes: - permissions (Sequence[str]): + permissions (MutableSequence[str]): A list of permissions. A sample permission string: ``compute.disk.get``. """ - permissions = proto.RepeatedField( + permissions: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - matched_permissions = proto.MapField( + matched_permissions: MutableMapping[str, 'IamPolicySearchResult.Explanation.Permissions'] = proto.MapField( proto.STRING, proto.MESSAGE, number=1, message='IamPolicySearchResult.Explanation.Permissions', ) - resource = proto.Field( + resource: str = proto.Field( proto.STRING, number=1, ) - asset_type = proto.Field( + asset_type: str = proto.Field( proto.STRING, number=5, ) - project = proto.Field( + project: str = proto.Field( proto.STRING, number=2, ) - folders = proto.RepeatedField( + folders: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=6, ) - organization = proto.Field( + organization: str = proto.Field( proto.STRING, number=7, ) - policy = proto.Field( + policy: policy_pb2.Policy = proto.Field( proto.MESSAGE, number=3, message=policy_pb2.Policy, ) - explanation = proto.Field( + explanation: Explanation = proto.Field( proto.MESSAGE, number=4, message=Explanation, @@ -810,12 +812,12 @@ class IamPolicyAnalysisState(proto.Message): of failure. """ - code = proto.Field( + code: code_pb2.Code = proto.Field( proto.ENUM, number=1, enum=code_pb2.Code, ) - cause = proto.Field( + cause: str = proto.Field( proto.STRING, number=2, ) @@ -835,7 +837,7 @@ class EvaluationValue(proto.Enum): FALSE = 2 CONDITIONAL = 3 - evaluation_value = proto.Field( + evaluation_value: EvaluationValue = proto.Field( proto.ENUM, number=1, enum=EvaluationValue, @@ -855,7 +857,7 @@ class IamPolicyAnalysisResult(proto.Message): policy attaches. iam_binding (google.iam.v1.policy_pb2.Binding): The Cloud IAM policy binding under analysis. - access_control_lists (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.AccessControlList]): + access_control_lists (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.AccessControlList]): The access control lists derived from the [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] that match or potentially match resource and access @@ -882,11 +884,11 @@ class Resource(proto.Message): The analysis state of this resource. """ - full_resource_name = proto.Field( + full_resource_name: str = proto.Field( proto.STRING, number=1, ) - analysis_state = proto.Field( + analysis_state: 'IamPolicyAnalysisState' = proto.Field( proto.MESSAGE, number=2, message='IamPolicyAnalysisState', @@ -915,17 +917,17 @@ class Access(proto.Message): The analysis state of this access. """ - role = proto.Field( + role: str = proto.Field( proto.STRING, number=1, oneof='oneof_access', ) - permission = proto.Field( + permission: str = proto.Field( proto.STRING, number=2, oneof='oneof_access', ) - analysis_state = proto.Field( + analysis_state: 'IamPolicyAnalysisState' = proto.Field( proto.MESSAGE, number=3, message='IamPolicyAnalysisState', @@ -952,11 +954,11 @@ class Identity(proto.Message): The analysis state of this identity. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - analysis_state = proto.Field( + analysis_state: 'IamPolicyAnalysisState' = proto.Field( proto.MESSAGE, number=2, message='IamPolicyAnalysisState', @@ -976,11 +978,11 @@ class Edge(proto.Message): node or an email of an identity. """ - source_node = proto.Field( + source_node: str = proto.Field( proto.STRING, number=1, ) - target_node = proto.Field( + target_node: str = proto.Field( proto.STRING, number=2, ) @@ -1006,19 +1008,19 @@ class AccessControlList(proto.Message): - AccessControlList 2: [R2, R3], [P3] Attributes: - resources (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Resource]): + resources (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Resource]): The resources that match one of the following conditions: - The resource_selector, if it is specified in request; - Otherwise, resources reachable from the policy attached resource. - accesses (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Access]): + accesses (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Access]): The accesses that match one of the following conditions: - The access_selector, if it is specified in request; - Otherwise, access specifiers reachable from the policy binding's role. - resource_edges (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Edge]): + resource_edges (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Edge]): Resource edges of the graph starting from the policy attached resource to any descendant resources. The [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node] @@ -1033,22 +1035,22 @@ class AccessControlList(proto.Message): defined in the above IAM policy binding. """ - resources = proto.RepeatedField( + resources: MutableSequence['IamPolicyAnalysisResult.Resource'] = proto.RepeatedField( proto.MESSAGE, number=1, message='IamPolicyAnalysisResult.Resource', ) - accesses = proto.RepeatedField( + accesses: MutableSequence['IamPolicyAnalysisResult.Access'] = proto.RepeatedField( proto.MESSAGE, number=2, message='IamPolicyAnalysisResult.Access', ) - resource_edges = proto.RepeatedField( + resource_edges: MutableSequence['IamPolicyAnalysisResult.Edge'] = proto.RepeatedField( proto.MESSAGE, number=3, message='IamPolicyAnalysisResult.Edge', ) - condition_evaluation = proto.Field( + condition_evaluation: 'ConditionEvaluation' = proto.Field( proto.MESSAGE, number=4, message='ConditionEvaluation', @@ -1058,14 +1060,14 @@ class IdentityList(proto.Message): r"""The identities and group edges. Attributes: - identities (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Identity]): + identities (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Identity]): Only the identities that match one of the following conditions will be presented: - The identity_selector, if it is specified in request; - Otherwise, identities reachable from the policy binding's members. - group_edges (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Edge]): + group_edges (MutableSequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Edge]): Group identity edges of the graph starting from the binding's group members to any node of the [identities][google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities]. @@ -1079,37 +1081,37 @@ class IdentityList(proto.Message): enabled in request. """ - identities = proto.RepeatedField( + identities: MutableSequence['IamPolicyAnalysisResult.Identity'] = proto.RepeatedField( proto.MESSAGE, number=1, message='IamPolicyAnalysisResult.Identity', ) - group_edges = proto.RepeatedField( + group_edges: MutableSequence['IamPolicyAnalysisResult.Edge'] = proto.RepeatedField( proto.MESSAGE, number=2, message='IamPolicyAnalysisResult.Edge', ) - attached_resource_full_name = proto.Field( + attached_resource_full_name: str = proto.Field( proto.STRING, number=1, ) - iam_binding = proto.Field( + iam_binding: policy_pb2.Binding = proto.Field( proto.MESSAGE, number=2, message=policy_pb2.Binding, ) - access_control_lists = proto.RepeatedField( + access_control_lists: MutableSequence[AccessControlList] = proto.RepeatedField( proto.MESSAGE, number=3, message=AccessControlList, ) - identity_list = proto.Field( + identity_list: IdentityList = proto.Field( proto.MESSAGE, number=4, message=IdentityList, ) - fully_explored = proto.Field( + fully_explored: bool = proto.Field( proto.BOOL, number=5, ) diff --git a/tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_google.cloud.asset.v1.json b/tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_google.cloud.asset.v1.json index ef7a24c377..5db3da5867 100644 --- a/tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_google.cloud.asset.v1.json +++ b/tests/integration/goldens/asset/samples/generated_samples/snippet_metadata_google.cloud.asset.v1.json @@ -1623,7 +1623,7 @@ }, { "name": "asset_types", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "retry", @@ -1711,7 +1711,7 @@ }, { "name": "asset_types", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "retry", diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py index 28f2323363..05f61eb269 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -149,9 +149,9 @@ def transport(self) -> IAMCredentialsTransport: get_transport_class = functools.partial(type(IAMCredentialsClient).get_transport_class, type(IAMCredentialsClient)) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, IAMCredentialsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the iam credentials client. @@ -195,14 +195,14 @@ def __init__(self, *, ) async def generate_access_token(self, - request: Union[common.GenerateAccessTokenRequest, dict] = None, + request: Optional[Union[common.GenerateAccessTokenRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - scope: Sequence[str] = None, - lifetime: duration_pb2.Duration = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + scope: Optional[MutableSequence[str]] = None, + lifetime: Optional[duration_pb2.Duration] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.GenerateAccessTokenResponse: r"""Generates an OAuth 2.0 access token for a service @@ -236,7 +236,7 @@ async def sample_generate_access_token(): print(response) Args: - request (Union[google.iam.credentials_v1.types.GenerateAccessTokenRequest, dict]): + request (Optional[Union[google.iam.credentials_v1.types.GenerateAccessTokenRequest, dict]]): The request object. name (:class:`str`): Required. The resource name of the service account for @@ -249,7 +249,7 @@ async def sample_generate_access_token(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (:class:`Sequence[str]`): + delegates (:class:`MutableSequence[str]`): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its @@ -267,7 +267,7 @@ async def sample_generate_access_token(): This corresponds to the ``delegates`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - scope (:class:`Sequence[str]`): + scope (:class:`MutableSequence[str]`): Required. Code to identify the scopes to be included in the OAuth 2.0 access token. See @@ -355,14 +355,14 @@ async def sample_generate_access_token(): return response async def generate_id_token(self, - request: Union[common.GenerateIdTokenRequest, dict] = None, + request: Optional[Union[common.GenerateIdTokenRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - audience: str = None, - include_email: bool = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + audience: Optional[str] = None, + include_email: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.GenerateIdTokenResponse: r"""Generates an OpenID Connect ID token for a service @@ -396,7 +396,7 @@ async def sample_generate_id_token(): print(response) Args: - request (Union[google.iam.credentials_v1.types.GenerateIdTokenRequest, dict]): + request (Optional[Union[google.iam.credentials_v1.types.GenerateIdTokenRequest, dict]]): The request object. name (:class:`str`): Required. The resource name of the service account for @@ -409,7 +409,7 @@ async def sample_generate_id_token(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (:class:`Sequence[str]`): + delegates (:class:`MutableSequence[str]`): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its @@ -509,13 +509,13 @@ async def sample_generate_id_token(): return response async def sign_blob(self, - request: Union[common.SignBlobRequest, dict] = None, + request: Optional[Union[common.SignBlobRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - payload: bytes = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + payload: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.SignBlobResponse: r"""Signs a blob using a service account's system-managed @@ -549,7 +549,7 @@ async def sample_sign_blob(): print(response) Args: - request (Union[google.iam.credentials_v1.types.SignBlobRequest, dict]): + request (Optional[Union[google.iam.credentials_v1.types.SignBlobRequest, dict]]): The request object. name (:class:`str`): Required. The resource name of the service account for @@ -562,7 +562,7 @@ async def sample_sign_blob(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (:class:`Sequence[str]`): + delegates (:class:`MutableSequence[str]`): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its @@ -649,13 +649,13 @@ async def sample_sign_blob(): return response async def sign_jwt(self, - request: Union[common.SignJwtRequest, dict] = None, + request: Optional[Union[common.SignJwtRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - payload: str = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + payload: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.SignJwtResponse: r"""Signs a JWT using a service account's system-managed @@ -689,7 +689,7 @@ async def sample_sign_jwt(): print(response) Args: - request (Union[google.iam.credentials_v1.types.SignJwtRequest, dict]): + request (Optional[Union[google.iam.credentials_v1.types.SignJwtRequest, dict]]): The request object. name (:class:`str`): Required. The resource name of the service account for @@ -702,7 +702,7 @@ async def sample_sign_jwt(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (:class:`Sequence[str]`): + delegates (:class:`MutableSequence[str]`): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py index 9e88f41d2f..bcf6585a0e 100644 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,7 @@ class IAMCredentialsClientMeta(type): _transport_registry["rest"] = IAMCredentialsRestTransport def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[IAMCredentialsTransport]: """Returns an appropriate transport class. @@ -299,7 +299,7 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, IAMCredentialsTransport, None] = None, + transport: Optional[Union[str, IAMCredentialsTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -389,14 +389,14 @@ def __init__(self, *, ) def generate_access_token(self, - request: Union[common.GenerateAccessTokenRequest, dict] = None, + request: Optional[Union[common.GenerateAccessTokenRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - scope: Sequence[str] = None, - lifetime: duration_pb2.Duration = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + scope: Optional[MutableSequence[str]] = None, + lifetime: Optional[duration_pb2.Duration] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.GenerateAccessTokenResponse: r"""Generates an OAuth 2.0 access token for a service @@ -443,7 +443,7 @@ def sample_generate_access_token(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its @@ -461,7 +461,7 @@ def sample_generate_access_token(): This corresponds to the ``delegates`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - scope (Sequence[str]): + scope (MutableSequence[str]): Required. Code to identify the scopes to be included in the OAuth 2.0 access token. See @@ -542,14 +542,14 @@ def sample_generate_access_token(): return response def generate_id_token(self, - request: Union[common.GenerateIdTokenRequest, dict] = None, + request: Optional[Union[common.GenerateIdTokenRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - audience: str = None, - include_email: bool = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + audience: Optional[str] = None, + include_email: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.GenerateIdTokenResponse: r"""Generates an OpenID Connect ID token for a service @@ -596,7 +596,7 @@ def sample_generate_id_token(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its @@ -689,13 +689,13 @@ def sample_generate_id_token(): return response def sign_blob(self, - request: Union[common.SignBlobRequest, dict] = None, + request: Optional[Union[common.SignBlobRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - payload: bytes = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + payload: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.SignBlobResponse: r"""Signs a blob using a service account's system-managed @@ -742,7 +742,7 @@ def sample_sign_blob(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its @@ -822,13 +822,13 @@ def sample_sign_blob(): return response def sign_jwt(self, - request: Union[common.SignJwtRequest, dict] = None, + request: Optional[Union[common.SignJwtRequest, dict]] = None, *, - name: str = None, - delegates: Sequence[str] = None, - payload: str = None, + name: Optional[str] = None, + delegates: Optional[MutableSequence[str]] = None, + payload: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> common.SignJwtResponse: r"""Signs a JWT using a service account's system-managed @@ -875,7 +875,7 @@ def sample_sign_jwt(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/base.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/base.py index 93b227c32e..eadf66db9a 100644 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/base.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/base.py @@ -48,7 +48,7 @@ class IAMCredentialsTransport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc.py index a3e8efecdf..c6f3288e91 100644 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc.py @@ -53,14 +53,14 @@ class IAMCredentialsGrpcTransport(IAMCredentialsTransport): def __init__(self, *, host: str = 'iamcredentials.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -186,8 +186,8 @@ def __init__(self, *, @classmethod def create_channel(cls, host: str = 'iamcredentials.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc_asyncio.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc_asyncio.py index a99e2df95d..524245c8c1 100644 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc_asyncio.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/grpc_asyncio.py @@ -57,7 +57,7 @@ class IAMCredentialsGrpcAsyncIOTransport(IAMCredentialsTransport): @classmethod def create_channel(cls, host: str = 'iamcredentials.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -97,15 +97,15 @@ def create_channel(cls, def __init__(self, *, host: str = 'iamcredentials.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py index e99175ac4f..7bc75d5d65 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py @@ -199,15 +199,15 @@ class IAMCredentialsRestTransport(IAMCredentialsTransport): def __init__(self, *, host: str = 'iamcredentials.googleapis.com', - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[IAMCredentialsRestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -286,9 +286,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: common.GenerateAccessTokenRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> common.GenerateAccessTokenResponse: r"""Call the generate access token method over HTTP. @@ -371,9 +371,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: common.GenerateIdTokenRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> common.GenerateIdTokenResponse: r"""Call the generate id token method over HTTP. @@ -456,9 +456,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: common.SignBlobRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> common.SignBlobResponse: r"""Call the sign blob method over HTTP. @@ -541,9 +541,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: common.SignJwtRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> common.SignJwtResponse: r"""Call the sign jwt method over HTTP. diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/types/common.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/types/common.py index a14b757350..e7c9076d39 100644 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/types/common.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/types/common.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.protobuf import duration_pb2 # type: ignore @@ -44,7 +46,7 @@ class GenerateAccessTokenRequest(proto.Message): ``projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}``. The ``-`` wildcard character is required; replacing it with a project ID is invalid. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its next @@ -58,7 +60,7 @@ class GenerateAccessTokenRequest(proto.Message): ``projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}``. The ``-`` wildcard character is required; replacing it with a project ID is invalid. - scope (Sequence[str]): + scope (MutableSequence[str]): Required. Code to identify the scopes to be included in the OAuth 2.0 access token. See https://developers.google.com/identity/protocols/googlescopes @@ -72,19 +74,19 @@ class GenerateAccessTokenRequest(proto.Message): to a default value of one hour. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - delegates = proto.RepeatedField( + delegates: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - scope = proto.RepeatedField( + scope: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=4, ) - lifetime = proto.Field( + lifetime: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=7, message=duration_pb2.Duration, @@ -102,11 +104,11 @@ class GenerateAccessTokenResponse(proto.Message): The expiration time is always set. """ - access_token = proto.Field( + access_token: str = proto.Field( proto.STRING, number=1, ) - expire_time = proto.Field( + expire_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, @@ -123,7 +125,7 @@ class SignBlobRequest(proto.Message): ``projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}``. The ``-`` wildcard character is required; replacing it with a project ID is invalid. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its next @@ -141,15 +143,15 @@ class SignBlobRequest(proto.Message): Required. The bytes to sign. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - delegates = proto.RepeatedField( + delegates: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - payload = proto.Field( + payload: bytes = proto.Field( proto.BYTES, number=5, ) @@ -165,11 +167,11 @@ class SignBlobResponse(proto.Message): The signed blob. """ - key_id = proto.Field( + key_id: str = proto.Field( proto.STRING, number=1, ) - signed_blob = proto.Field( + signed_blob: bytes = proto.Field( proto.BYTES, number=4, ) @@ -185,7 +187,7 @@ class SignJwtRequest(proto.Message): ``projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}``. The ``-`` wildcard character is required; replacing it with a project ID is invalid. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its next @@ -204,15 +206,15 @@ class SignJwtRequest(proto.Message): object that contains a JWT Claims Set. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - delegates = proto.RepeatedField( + delegates: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - payload = proto.Field( + payload: str = proto.Field( proto.STRING, number=5, ) @@ -228,11 +230,11 @@ class SignJwtResponse(proto.Message): The signed JWT. """ - key_id = proto.Field( + key_id: str = proto.Field( proto.STRING, number=1, ) - signed_jwt = proto.Field( + signed_jwt: str = proto.Field( proto.STRING, number=2, ) @@ -248,7 +250,7 @@ class GenerateIdTokenRequest(proto.Message): ``projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}``. The ``-`` wildcard character is required; replacing it with a project ID is invalid. - delegates (Sequence[str]): + delegates (MutableSequence[str]): The sequence of service accounts in a delegation chain. Each service account must be granted the ``roles/iam.serviceAccountTokenCreator`` role on its next @@ -272,19 +274,19 @@ class GenerateIdTokenRequest(proto.Message): ``email_verified`` claims. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - delegates = proto.RepeatedField( + delegates: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - audience = proto.Field( + audience: str = proto.Field( proto.STRING, number=3, ) - include_email = proto.Field( + include_email: bool = proto.Field( proto.BOOL, number=4, ) @@ -298,7 +300,7 @@ class GenerateIdTokenResponse(proto.Message): The OpenId Connect ID token. """ - token = proto.Field( + token: str = proto.Field( proto.STRING, number=1, ) diff --git a/tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_google.iam.credentials.v1.json b/tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_google.iam.credentials.v1.json index 8f25e0e917..317a7f4a2d 100644 --- a/tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_google.iam.credentials.v1.json +++ b/tests/integration/goldens/credentials/samples/generated_samples/snippet_metadata_google.iam.credentials.v1.json @@ -39,11 +39,11 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "scope", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "lifetime", @@ -131,11 +131,11 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "scope", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "lifetime", @@ -224,7 +224,7 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "audience", @@ -316,7 +316,7 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "audience", @@ -409,7 +409,7 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "payload", @@ -497,7 +497,7 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "payload", @@ -586,7 +586,7 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "payload", @@ -674,7 +674,7 @@ }, { "name": "delegates", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "payload", diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py index 2d6f5252e8..d799051df1 100755 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -151,9 +151,9 @@ def transport(self) -> EventarcTransport: get_transport_class = functools.partial(type(EventarcClient).get_transport_class, type(EventarcClient)) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, EventarcTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the eventarc client. @@ -197,11 +197,11 @@ def __init__(self, *, ) async def get_trigger(self, - request: Union[eventarc.GetTriggerRequest, dict] = None, + request: Optional[Union[eventarc.GetTriggerRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> trigger.Trigger: r"""Get a single trigger. @@ -233,7 +233,7 @@ async def sample_get_trigger(): print(response) Args: - request (Union[google.cloud.eventarc_v1.types.GetTriggerRequest, dict]): + request (Optional[Union[google.cloud.eventarc_v1.types.GetTriggerRequest, dict]]): The request object. The request message for the GetTrigger method. name (:class:`str`): @@ -298,11 +298,11 @@ async def sample_get_trigger(): return response async def list_triggers(self, - request: Union[eventarc.ListTriggersRequest, dict] = None, + request: Optional[Union[eventarc.ListTriggersRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTriggersAsyncPager: r"""List triggers. @@ -335,7 +335,7 @@ async def sample_list_triggers(): print(response) Args: - request (Union[google.cloud.eventarc_v1.types.ListTriggersRequest, dict]): + request (Optional[Union[google.cloud.eventarc_v1.types.ListTriggersRequest, dict]]): The request object. The request message for the ListTriggers method. parent (:class:`str`): @@ -412,13 +412,13 @@ async def sample_list_triggers(): return response async def create_trigger(self, - request: Union[eventarc.CreateTriggerRequest, dict] = None, + request: Optional[Union[eventarc.CreateTriggerRequest, dict]] = None, *, - parent: str = None, - trigger: gce_trigger.Trigger = None, - trigger_id: str = None, + parent: Optional[str] = None, + trigger: Optional[gce_trigger.Trigger] = None, + trigger_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Create a new trigger in a particular project and @@ -465,7 +465,7 @@ async def sample_create_trigger(): print(response) Args: - request (Union[google.cloud.eventarc_v1.types.CreateTriggerRequest, dict]): + request (Optional[Union[google.cloud.eventarc_v1.types.CreateTriggerRequest, dict]]): The request object. The request message for the CreateTrigger method. parent (:class:`str`): @@ -557,13 +557,13 @@ async def sample_create_trigger(): return response async def update_trigger(self, - request: Union[eventarc.UpdateTriggerRequest, dict] = None, + request: Optional[Union[eventarc.UpdateTriggerRequest, dict]] = None, *, - trigger: gce_trigger.Trigger = None, - update_mask: field_mask_pb2.FieldMask = None, - allow_missing: bool = None, + trigger: Optional[gce_trigger.Trigger] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + allow_missing: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Update a single trigger. @@ -599,7 +599,7 @@ async def sample_update_trigger(): print(response) Args: - request (Union[google.cloud.eventarc_v1.types.UpdateTriggerRequest, dict]): + request (Optional[Union[google.cloud.eventarc_v1.types.UpdateTriggerRequest, dict]]): The request object. The request message for the UpdateTrigger method. trigger (:class:`google.cloud.eventarc_v1.types.Trigger`): @@ -694,12 +694,12 @@ async def sample_update_trigger(): return response async def delete_trigger(self, - request: Union[eventarc.DeleteTriggerRequest, dict] = None, + request: Optional[Union[eventarc.DeleteTriggerRequest, dict]] = None, *, - name: str = None, - allow_missing: bool = None, + name: Optional[str] = None, + allow_missing: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Delete a single trigger. @@ -736,7 +736,7 @@ async def sample_delete_trigger(): print(response) Args: - request (Union[google.cloud.eventarc_v1.types.DeleteTriggerRequest, dict]): + request (Optional[Union[google.cloud.eventarc_v1.types.DeleteTriggerRequest, dict]]): The request object. The request message for the DeleteTrigger method. name (:class:`str`): diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/client.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/client.py index 5a2bb9949b..b6659bbfce 100644 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/client.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,7 @@ class EventarcClientMeta(type): _transport_registry["rest"] = EventarcRestTransport def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[EventarcTransport]: """Returns an appropriate transport class. @@ -319,7 +319,7 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, EventarcTransport, None] = None, + transport: Optional[Union[str, EventarcTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -409,11 +409,11 @@ def __init__(self, *, ) def get_trigger(self, - request: Union[eventarc.GetTriggerRequest, dict] = None, + request: Optional[Union[eventarc.GetTriggerRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> trigger.Trigger: r"""Get a single trigger. @@ -510,11 +510,11 @@ def sample_get_trigger(): return response def list_triggers(self, - request: Union[eventarc.ListTriggersRequest, dict] = None, + request: Optional[Union[eventarc.ListTriggersRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTriggersPager: r"""List triggers. @@ -624,13 +624,13 @@ def sample_list_triggers(): return response def create_trigger(self, - request: Union[eventarc.CreateTriggerRequest, dict] = None, + request: Optional[Union[eventarc.CreateTriggerRequest, dict]] = None, *, - parent: str = None, - trigger: gce_trigger.Trigger = None, - trigger_id: str = None, + parent: Optional[str] = None, + trigger: Optional[gce_trigger.Trigger] = None, + trigger_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Create a new trigger in a particular project and @@ -769,13 +769,13 @@ def sample_create_trigger(): return response def update_trigger(self, - request: Union[eventarc.UpdateTriggerRequest, dict] = None, + request: Optional[Union[eventarc.UpdateTriggerRequest, dict]] = None, *, - trigger: gce_trigger.Trigger = None, - update_mask: field_mask_pb2.FieldMask = None, - allow_missing: bool = None, + trigger: Optional[gce_trigger.Trigger] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + allow_missing: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Update a single trigger. @@ -906,12 +906,12 @@ def sample_update_trigger(): return response def delete_trigger(self, - request: Union[eventarc.DeleteTriggerRequest, dict] = None, + request: Optional[Union[eventarc.DeleteTriggerRequest, dict]] = None, *, - name: str = None, - allow_missing: bool = None, + name: Optional[str] = None, + allow_missing: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Delete a single trigger. diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/base.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/base.py index d15e1f50a8..808dc4f3b5 100644 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/base.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/base.py @@ -51,7 +51,7 @@ class EventarcTransport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc.py index 73d6ca9fbf..fd8dae846b 100644 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc.py @@ -49,14 +49,14 @@ class EventarcGrpcTransport(EventarcTransport): def __init__(self, *, host: str = 'eventarc.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -183,8 +183,8 @@ def __init__(self, *, @classmethod def create_channel(cls, host: str = 'eventarc.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc_asyncio.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc_asyncio.py index 780b937d80..20982c46e3 100644 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc_asyncio.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/grpc_asyncio.py @@ -53,7 +53,7 @@ class EventarcGrpcAsyncIOTransport(EventarcTransport): @classmethod def create_channel(cls, host: str = 'eventarc.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +93,15 @@ def create_channel(cls, def __init__(self, *, host: str = 'eventarc.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py index edceb04776..96bd6f82df 100755 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py @@ -218,15 +218,15 @@ class EventarcRestTransport(EventarcTransport): def __init__(self, *, host: str = 'eventarc.googleapis.com', - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[EventarcRestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -330,9 +330,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: eventarc.CreateTriggerRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the create trigger method over HTTP. @@ -418,9 +418,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: eventarc.DeleteTriggerRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the delete trigger method over HTTP. @@ -497,9 +497,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: eventarc.GetTriggerRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> trigger.Trigger: r"""Call the get trigger method over HTTP. @@ -577,9 +577,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: eventarc.ListTriggersRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> eventarc.ListTriggersResponse: r"""Call the list triggers method over HTTP. @@ -657,9 +657,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: eventarc.UpdateTriggerRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the update trigger method over HTTP. diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/eventarc.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/eventarc.py index 657966bc72..9a1cc43bb4 100644 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/eventarc.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/eventarc.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.eventarc_v1.types import trigger as gce_trigger @@ -42,7 +44,7 @@ class GetTriggerRequest(proto.Message): Required. The name of the trigger to get. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -74,19 +76,19 @@ class ListTriggersRequest(proto.Message): ``name desc, trigger_id``. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=4, ) @@ -96,14 +98,14 @@ class ListTriggersResponse(proto.Message): r"""The response message for the ListTriggers method. Attributes: - triggers (Sequence[google.cloud.eventarc_v1.types.Trigger]): + triggers (MutableSequence[google.cloud.eventarc_v1.types.Trigger]): The requested triggers, up to the number specified in ``page_size``. next_page_token (str): A page token that can be sent to ListTriggers to request the next page. If this is empty, then there are no more pages. - unreachable (Sequence[str]): + unreachable (MutableSequence[str]): Unreachable resources, if any. """ @@ -111,16 +113,16 @@ class ListTriggersResponse(proto.Message): def raw_page(self): return self - triggers = proto.RepeatedField( + triggers: MutableSequence[gce_trigger.Trigger] = proto.RepeatedField( proto.MESSAGE, number=1, message=gce_trigger.Trigger, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - unreachable = proto.RepeatedField( + unreachable: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -143,20 +145,20 @@ class CreateTriggerRequest(proto.Message): preview the review, but do not actually post it. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - trigger = proto.Field( + trigger: gce_trigger.Trigger = proto.Field( proto.MESSAGE, number=2, message=gce_trigger.Trigger, ) - trigger_id = proto.Field( + trigger_id: str = proto.Field( proto.STRING, number=3, ) - validate_only = proto.Field( + validate_only: bool = proto.Field( proto.BOOL, number=4, ) @@ -182,21 +184,21 @@ class UpdateTriggerRequest(proto.Message): preview the review, but do not actually post it. """ - trigger = proto.Field( + trigger: gce_trigger.Trigger = proto.Field( proto.MESSAGE, number=1, message=gce_trigger.Trigger, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, ) - allow_missing = proto.Field( + allow_missing: bool = proto.Field( proto.BOOL, number=3, ) - validate_only = proto.Field( + validate_only: bool = proto.Field( proto.BOOL, number=4, ) @@ -222,19 +224,19 @@ class DeleteTriggerRequest(proto.Message): preview the review, but do not actually post it. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - etag = proto.Field( + etag: str = proto.Field( proto.STRING, number=2, ) - allow_missing = proto.Field( + allow_missing: bool = proto.Field( proto.BOOL, number=3, ) - validate_only = proto.Field( + validate_only: bool = proto.Field( proto.BOOL, number=4, ) @@ -270,33 +272,33 @@ class OperationMetadata(proto.Message): operation. """ - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - target = proto.Field( + target: str = proto.Field( proto.STRING, number=3, ) - verb = proto.Field( + verb: str = proto.Field( proto.STRING, number=4, ) - status_message = proto.Field( + status_message: str = proto.Field( proto.STRING, number=5, ) - requested_cancellation = proto.Field( + requested_cancellation: bool = proto.Field( proto.BOOL, number=6, ) - api_version = proto.Field( + api_version: str = proto.Field( proto.STRING, number=7, ) diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/trigger.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/trigger.py index e5db1c8227..77b1cb69c8 100644 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/trigger.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/types/trigger.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.protobuf import timestamp_pb2 # type: ignore @@ -49,7 +51,7 @@ class Trigger(proto.Message): Output only. The creation time. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last-modified time. - event_filters (Sequence[google.cloud.eventarc_v1.types.EventFilter]): + event_filters (MutableSequence[google.cloud.eventarc_v1.types.EventFilter]): Required. null The list of filters that applies to event attributes. Only events that match all the provided filters will be sent to @@ -81,7 +83,7 @@ class Trigger(proto.Message): intermediary. This field contains a reference to that transport intermediary. This information can be used for debugging purposes. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Optional. User labels attached to the triggers that can be used to group resources. etag (str): @@ -92,49 +94,49 @@ class Trigger(proto.Message): proceeding. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - uid = proto.Field( + uid: str = proto.Field( proto.STRING, number=2, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) - event_filters = proto.RepeatedField( + event_filters: MutableSequence['EventFilter'] = proto.RepeatedField( proto.MESSAGE, number=8, message='EventFilter', ) - service_account = proto.Field( + service_account: str = proto.Field( proto.STRING, number=9, ) - destination = proto.Field( + destination: 'Destination' = proto.Field( proto.MESSAGE, number=10, message='Destination', ) - transport = proto.Field( + transport: 'Transport' = proto.Field( proto.MESSAGE, number=11, message='Transport', ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=12, ) - etag = proto.Field( + etag: str = proto.Field( proto.STRING, number=99, ) @@ -155,11 +157,11 @@ class EventFilter(proto.Message): Required. The value for the attribute. """ - attribute = proto.Field( + attribute: str = proto.Field( proto.STRING, number=1, ) - value = proto.Field( + value: str = proto.Field( proto.STRING, number=2, ) @@ -179,7 +181,7 @@ class Destination(proto.Message): This field is a member of `oneof`_ ``descriptor``. """ - cloud_run = proto.Field( + cloud_run: 'CloudRun' = proto.Field( proto.MESSAGE, number=1, oneof='descriptor', @@ -202,7 +204,7 @@ class Transport(proto.Message): This field is a member of `oneof`_ ``intermediary``. """ - pubsub = proto.Field( + pubsub: 'Pubsub' = proto.Field( proto.MESSAGE, number=1, oneof='intermediary', @@ -232,15 +234,15 @@ class CloudRun(proto.Message): deployed in. """ - service = proto.Field( + service: str = proto.Field( proto.STRING, number=1, ) - path = proto.Field( + path: str = proto.Field( proto.STRING, number=2, ) - region = proto.Field( + region: str = proto.Field( proto.STRING, number=3, ) @@ -266,11 +268,11 @@ class Pubsub(proto.Message): ``projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}``. """ - topic = proto.Field( + topic: str = proto.Field( proto.STRING, number=1, ) - subscription = proto.Field( + subscription: str = proto.Field( proto.STRING, number=2, ) diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py index da931475a8..f2e13824a0 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -148,9 +148,9 @@ def transport(self) -> ConfigServiceV2Transport: get_transport_class = functools.partial(type(ConfigServiceV2Client).get_transport_class, type(ConfigServiceV2Client)) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ConfigServiceV2Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the config service v2 client. @@ -194,11 +194,11 @@ def __init__(self, *, ) async def list_buckets(self, - request: Union[logging_config.ListBucketsRequest, dict] = None, + request: Optional[Union[logging_config.ListBucketsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListBucketsAsyncPager: r"""Lists buckets. @@ -231,7 +231,7 @@ async def sample_list_buckets(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]]): The request object. The parameters to `ListBuckets`. parent (:class:`str`): Required. The parent resource whose buckets are to be @@ -317,10 +317,10 @@ async def sample_list_buckets(): return response async def get_bucket(self, - request: Union[logging_config.GetBucketRequest, dict] = None, + request: Optional[Union[logging_config.GetBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Gets a bucket. @@ -352,7 +352,7 @@ async def sample_get_bucket(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetBucketRequest, dict]]): The request object. The parameters to `GetBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -395,10 +395,10 @@ async def sample_get_bucket(): return response async def create_bucket(self, - request: Union[logging_config.CreateBucketRequest, dict] = None, + request: Optional[Union[logging_config.CreateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Creates a bucket that can be used to store log @@ -433,7 +433,7 @@ async def sample_create_bucket(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]]): The request object. The parameters to `CreateBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -476,10 +476,10 @@ async def sample_create_bucket(): return response async def update_bucket(self, - request: Union[logging_config.UpdateBucketRequest, dict] = None, + request: Optional[Union[logging_config.UpdateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Updates a bucket. This method replaces the following fields in @@ -521,7 +521,7 @@ async def sample_update_bucket(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]]): The request object. The parameters to `UpdateBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -564,10 +564,10 @@ async def sample_update_bucket(): return response async def delete_bucket(self, - request: Union[logging_config.DeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.DeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a bucket. Moves the bucket to the DELETE_REQUESTED @@ -598,7 +598,7 @@ async def sample_delete_bucket(): await client.delete_bucket(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]]): The request object. The parameters to `DeleteBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -634,10 +634,10 @@ async def sample_delete_bucket(): ) async def undelete_bucket(self, - request: Union[logging_config.UndeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.UndeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Undeletes a bucket. A bucket that has been deleted @@ -667,7 +667,7 @@ async def sample_undelete_bucket(): await client.undelete_bucket(request=request) Args: - request (Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]]): The request object. The parameters to `UndeleteBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -703,11 +703,11 @@ async def sample_undelete_bucket(): ) async def list_views(self, - request: Union[logging_config.ListViewsRequest, dict] = None, + request: Optional[Union[logging_config.ListViewsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListViewsAsyncPager: r"""Lists views on a bucket. @@ -740,7 +740,7 @@ async def sample_list_views(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListViewsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListViewsRequest, dict]]): The request object. The parameters to `ListViews`. parent (:class:`str`): Required. The bucket whose views are to be listed: @@ -818,10 +818,10 @@ async def sample_list_views(): return response async def get_view(self, - request: Union[logging_config.GetViewRequest, dict] = None, + request: Optional[Union[logging_config.GetViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Gets a view. @@ -853,7 +853,7 @@ async def sample_get_view(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetViewRequest, dict]]): The request object. The parameters to `GetView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -898,10 +898,10 @@ async def sample_get_view(): return response async def create_view(self, - request: Union[logging_config.CreateViewRequest, dict] = None, + request: Optional[Union[logging_config.CreateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Creates a view over logs in a bucket. A bucket may @@ -935,7 +935,7 @@ async def sample_create_view(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateViewRequest, dict]]): The request object. The parameters to `CreateView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -980,10 +980,10 @@ async def sample_create_view(): return response async def update_view(self, - request: Union[logging_config.UpdateViewRequest, dict] = None, + request: Optional[Union[logging_config.UpdateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Updates a view. This method replaces the following fields in the @@ -1016,7 +1016,7 @@ async def sample_update_view(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]]): The request object. The parameters to `UpdateView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -1061,10 +1061,10 @@ async def sample_update_view(): return response async def delete_view(self, - request: Union[logging_config.DeleteViewRequest, dict] = None, + request: Optional[Union[logging_config.DeleteViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a view from a bucket. @@ -1093,7 +1093,7 @@ async def sample_delete_view(): await client.delete_view(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]]): The request object. The parameters to `DeleteView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -1129,11 +1129,11 @@ async def sample_delete_view(): ) async def list_sinks(self, - request: Union[logging_config.ListSinksRequest, dict] = None, + request: Optional[Union[logging_config.ListSinksRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListSinksAsyncPager: r"""Lists sinks. @@ -1166,7 +1166,7 @@ async def sample_list_sinks(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListSinksRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListSinksRequest, dict]]): The request object. The parameters to `ListSinks`. parent (:class:`str`): Required. The parent resource whose sinks are to be @@ -1256,11 +1256,11 @@ async def sample_list_sinks(): return response async def get_sink(self, - request: Union[logging_config.GetSinkRequest, dict] = None, + request: Optional[Union[logging_config.GetSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Gets a sink. @@ -1292,7 +1292,7 @@ async def sample_get_sink(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetSinkRequest, dict]]): The request object. The parameters to `GetSink`. sink_name (:class:`str`): Required. The resource name of the sink: @@ -1379,12 +1379,12 @@ async def sample_get_sink(): return response async def create_sink(self, - request: Union[logging_config.CreateSinkRequest, dict] = None, + request: Optional[Union[logging_config.CreateSinkRequest, dict]] = None, *, - parent: str = None, - sink: logging_config.LogSink = None, + parent: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Creates a sink that exports specified log entries to a @@ -1425,7 +1425,7 @@ async def sample_create_sink(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]]): The request object. The parameters to `CreateSink`. parent (:class:`str`): Required. The resource in which to create the sink: @@ -1514,13 +1514,13 @@ async def sample_create_sink(): return response async def update_sink(self, - request: Union[logging_config.UpdateSinkRequest, dict] = None, + request: Optional[Union[logging_config.UpdateSinkRequest, dict]] = None, *, - sink_name: str = None, - sink: logging_config.LogSink = None, - update_mask: field_mask_pb2.FieldMask = None, + sink_name: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Updates a sink. This method replaces the following fields in the @@ -1562,7 +1562,7 @@ async def sample_update_sink(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]]): The request object. The parameters to `UpdateSink`. sink_name (:class:`str`): Required. The full resource name of the sink to update, @@ -1681,11 +1681,11 @@ async def sample_update_sink(): return response async def delete_sink(self, - request: Union[logging_config.DeleteSinkRequest, dict] = None, + request: Optional[Union[logging_config.DeleteSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a sink. If the sink has a unique ``writer_identity``, @@ -1715,7 +1715,7 @@ async def sample_delete_sink(): await client.delete_sink(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]]): The request object. The parameters to `DeleteSink`. sink_name (:class:`str`): Required. The full resource name of the sink to delete, @@ -1787,11 +1787,11 @@ async def sample_delete_sink(): ) async def list_exclusions(self, - request: Union[logging_config.ListExclusionsRequest, dict] = None, + request: Optional[Union[logging_config.ListExclusionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExclusionsAsyncPager: r"""Lists all the exclusions in a parent resource. @@ -1824,7 +1824,7 @@ async def sample_list_exclusions(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]]): The request object. The parameters to `ListExclusions`. parent (:class:`str`): Required. The parent resource whose exclusions are to be @@ -1914,11 +1914,11 @@ async def sample_list_exclusions(): return response async def get_exclusion(self, - request: Union[logging_config.GetExclusionRequest, dict] = None, + request: Optional[Union[logging_config.GetExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Gets the description of an exclusion. @@ -1950,7 +1950,7 @@ async def sample_get_exclusion(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]]): The request object. The parameters to `GetExclusion`. name (:class:`str`): Required. The resource name of an existing exclusion: @@ -2040,12 +2040,12 @@ async def sample_get_exclusion(): return response async def create_exclusion(self, - request: Union[logging_config.CreateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.CreateExclusionRequest, dict]] = None, *, - parent: str = None, - exclusion: logging_config.LogExclusion = None, + parent: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Creates a new exclusion in a specified parent @@ -2085,7 +2085,7 @@ async def sample_create_exclusion(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]]): The request object. The parameters to `CreateExclusion`. parent (:class:`str`): Required. The parent resource in which to create the @@ -2178,13 +2178,13 @@ async def sample_create_exclusion(): return response async def update_exclusion(self, - request: Union[logging_config.UpdateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.UpdateExclusionRequest, dict]] = None, *, - name: str = None, - exclusion: logging_config.LogExclusion = None, - update_mask: field_mask_pb2.FieldMask = None, + name: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Changes one or more properties of an existing @@ -2222,7 +2222,7 @@ async def sample_update_exclusion(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]]): The request object. The parameters to `UpdateExclusion`. name (:class:`str`): Required. The resource name of the exclusion to update: @@ -2330,11 +2330,11 @@ async def sample_update_exclusion(): return response async def delete_exclusion(self, - request: Union[logging_config.DeleteExclusionRequest, dict] = None, + request: Optional[Union[logging_config.DeleteExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an exclusion. @@ -2363,7 +2363,7 @@ async def sample_delete_exclusion(): await client.delete_exclusion(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]]): The request object. The parameters to `DeleteExclusion`. name (:class:`str`): Required. The resource name of an existing exclusion to @@ -2436,10 +2436,10 @@ async def sample_delete_exclusion(): ) async def get_cmek_settings(self, - request: Union[logging_config.GetCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.GetCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Gets the Logs Router CMEK settings for the given resource. @@ -2479,7 +2479,7 @@ async def sample_get_cmek_settings(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]]): The request object. The parameters to [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings]. See [Enabling CMEK for Logs @@ -2538,10 +2538,10 @@ async def sample_get_cmek_settings(): return response async def update_cmek_settings(self, - request: Union[logging_config.UpdateCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.UpdateCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Updates the Logs Router CMEK settings for the given resource. @@ -2587,7 +2587,7 @@ async def sample_update_cmek_settings(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]]): The request object. The parameters to [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]. See [Enabling CMEK for Logs diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py index 8e5b28b9e8..92de685b1a 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast import pkg_resources from google.api_core import client_options as client_options_lib @@ -57,7 +57,7 @@ class ConfigServiceV2ClientMeta(type): _transport_registry["rest"] = ConfigServiceV2RestTransport def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ConfigServiceV2Transport]: """Returns an appropriate transport class. @@ -334,7 +334,7 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ConfigServiceV2Transport, None] = None, + transport: Optional[Union[str, ConfigServiceV2Transport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -424,11 +424,11 @@ def __init__(self, *, ) def list_buckets(self, - request: Union[logging_config.ListBucketsRequest, dict] = None, + request: Optional[Union[logging_config.ListBucketsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListBucketsPager: r"""Lists buckets. @@ -547,10 +547,10 @@ def sample_list_buckets(): return response def get_bucket(self, - request: Union[logging_config.GetBucketRequest, dict] = None, + request: Optional[Union[logging_config.GetBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Gets a bucket. @@ -626,10 +626,10 @@ def sample_get_bucket(): return response def create_bucket(self, - request: Union[logging_config.CreateBucketRequest, dict] = None, + request: Optional[Union[logging_config.CreateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Creates a bucket that can be used to store log @@ -708,10 +708,10 @@ def sample_create_bucket(): return response def update_bucket(self, - request: Union[logging_config.UpdateBucketRequest, dict] = None, + request: Optional[Union[logging_config.UpdateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Updates a bucket. This method replaces the following fields in @@ -797,10 +797,10 @@ def sample_update_bucket(): return response def delete_bucket(self, - request: Union[logging_config.DeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.DeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a bucket. Moves the bucket to the DELETE_REQUESTED @@ -868,10 +868,10 @@ def sample_delete_bucket(): ) def undelete_bucket(self, - request: Union[logging_config.UndeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.UndeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Undeletes a bucket. A bucket that has been deleted @@ -938,11 +938,11 @@ def sample_undelete_bucket(): ) def list_views(self, - request: Union[logging_config.ListViewsRequest, dict] = None, + request: Optional[Union[logging_config.ListViewsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListViewsPager: r"""Lists views on a bucket. @@ -1053,10 +1053,10 @@ def sample_list_views(): return response def get_view(self, - request: Union[logging_config.GetViewRequest, dict] = None, + request: Optional[Union[logging_config.GetViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Gets a view. @@ -1134,10 +1134,10 @@ def sample_get_view(): return response def create_view(self, - request: Union[logging_config.CreateViewRequest, dict] = None, + request: Optional[Union[logging_config.CreateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Creates a view over logs in a bucket. A bucket may @@ -1217,10 +1217,10 @@ def sample_create_view(): return response def update_view(self, - request: Union[logging_config.UpdateViewRequest, dict] = None, + request: Optional[Union[logging_config.UpdateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Updates a view. This method replaces the following fields in the @@ -1299,10 +1299,10 @@ def sample_update_view(): return response def delete_view(self, - request: Union[logging_config.DeleteViewRequest, dict] = None, + request: Optional[Union[logging_config.DeleteViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a view from a bucket. @@ -1368,11 +1368,11 @@ def sample_delete_view(): ) def list_sinks(self, - request: Union[logging_config.ListSinksRequest, dict] = None, + request: Optional[Union[logging_config.ListSinksRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListSinksPager: r"""Lists sinks. @@ -1487,11 +1487,11 @@ def sample_list_sinks(): return response def get_sink(self, - request: Union[logging_config.GetSinkRequest, dict] = None, + request: Optional[Union[logging_config.GetSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Gets a sink. @@ -1602,12 +1602,12 @@ def sample_get_sink(): return response def create_sink(self, - request: Union[logging_config.CreateSinkRequest, dict] = None, + request: Optional[Union[logging_config.CreateSinkRequest, dict]] = None, *, - parent: str = None, - sink: logging_config.LogSink = None, + parent: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Creates a sink that exports specified log entries to a @@ -1737,13 +1737,13 @@ def sample_create_sink(): return response def update_sink(self, - request: Union[logging_config.UpdateSinkRequest, dict] = None, + request: Optional[Union[logging_config.UpdateSinkRequest, dict]] = None, *, - sink_name: str = None, - sink: logging_config.LogSink = None, - update_mask: field_mask_pb2.FieldMask = None, + sink_name: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Updates a sink. This method replaces the following fields in the @@ -1896,11 +1896,11 @@ def sample_update_sink(): return response def delete_sink(self, - request: Union[logging_config.DeleteSinkRequest, dict] = None, + request: Optional[Union[logging_config.DeleteSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a sink. If the sink has a unique ``writer_identity``, @@ -1994,11 +1994,11 @@ def sample_delete_sink(): ) def list_exclusions(self, - request: Union[logging_config.ListExclusionsRequest, dict] = None, + request: Optional[Union[logging_config.ListExclusionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExclusionsPager: r"""Lists all the exclusions in a parent resource. @@ -2113,11 +2113,11 @@ def sample_list_exclusions(): return response def get_exclusion(self, - request: Union[logging_config.GetExclusionRequest, dict] = None, + request: Optional[Union[logging_config.GetExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Gets the description of an exclusion. @@ -2231,12 +2231,12 @@ def sample_get_exclusion(): return response def create_exclusion(self, - request: Union[logging_config.CreateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.CreateExclusionRequest, dict]] = None, *, - parent: str = None, - exclusion: logging_config.LogExclusion = None, + parent: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Creates a new exclusion in a specified parent @@ -2369,13 +2369,13 @@ def sample_create_exclusion(): return response def update_exclusion(self, - request: Union[logging_config.UpdateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.UpdateExclusionRequest, dict]] = None, *, - name: str = None, - exclusion: logging_config.LogExclusion = None, - update_mask: field_mask_pb2.FieldMask = None, + name: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Changes one or more properties of an existing @@ -2521,11 +2521,11 @@ def sample_update_exclusion(): return response def delete_exclusion(self, - request: Union[logging_config.DeleteExclusionRequest, dict] = None, + request: Optional[Union[logging_config.DeleteExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an exclusion. @@ -2619,10 +2619,10 @@ def sample_delete_exclusion(): ) def get_cmek_settings(self, - request: Union[logging_config.GetCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.GetCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Gets the Logs Router CMEK settings for the given resource. @@ -2722,10 +2722,10 @@ def sample_get_cmek_settings(): return response def update_cmek_settings(self, - request: Union[logging_config.UpdateCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.UpdateCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Updates the Logs Router CMEK settings for the given resource. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/base.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/base.py index ed139098d8..df6f3e7a1f 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/base.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/base.py @@ -52,7 +52,7 @@ class ConfigServiceV2Transport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py index 9d01152fb6..8b912be154 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py @@ -45,14 +45,14 @@ class ConfigServiceV2GrpcTransport(ConfigServiceV2Transport): def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -178,8 +178,8 @@ def __init__(self, *, @classmethod def create_channel(cls, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py index dca620f310..7808861720 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class ConfigServiceV2GrpcAsyncIOTransport(ConfigServiceV2Transport): @classmethod def create_channel(cls, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -89,15 +89,15 @@ def create_channel(cls, def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py index f27ee0360b..fe03b8b2b9 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py @@ -573,15 +573,15 @@ class ConfigServiceV2RestTransport(ConfigServiceV2Transport): def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[ConfigServiceV2RestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -660,9 +660,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.CreateBucketRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Call the create bucket method over HTTP. @@ -765,9 +765,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.CreateExclusionRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Call the create exclusion method over HTTP. @@ -881,9 +881,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.CreateSinkRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Call the create sink method over HTTP. @@ -995,9 +995,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.CreateViewRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Call the create view method over HTTP. @@ -1102,9 +1102,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.DeleteBucketRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the delete bucket method over HTTP. @@ -1182,9 +1182,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.DeleteExclusionRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the delete exclusion method over HTTP. @@ -1262,9 +1262,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.DeleteSinkRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the delete sink method over HTTP. @@ -1342,9 +1342,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.DeleteViewRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the delete view method over HTTP. @@ -1422,9 +1422,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.GetBucketRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Call the get bucket method over HTTP. @@ -1514,9 +1514,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.GetCmekSettingsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Call the get cmek settings method over HTTP. @@ -1612,9 +1612,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.GetExclusionRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Call the get exclusion method over HTTP. @@ -1715,9 +1715,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.GetSinkRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Call the get sink method over HTTP. @@ -1816,9 +1816,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.GetViewRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Call the get view method over HTTP. @@ -1910,9 +1910,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.ListBucketsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.ListBucketsResponse: r"""Call the list buckets method over HTTP. @@ -2002,9 +2002,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.ListExclusionsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.ListExclusionsResponse: r"""Call the list exclusions method over HTTP. @@ -2094,9 +2094,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.ListSinksRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.ListSinksResponse: r"""Call the list sinks method over HTTP. @@ -2186,9 +2186,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.ListViewsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.ListViewsResponse: r"""Call the list views method over HTTP. @@ -2278,9 +2278,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.UndeleteBucketRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the undelete bucket method over HTTP. @@ -2371,9 +2371,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.UpdateBucketRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Call the update bucket method over HTTP. @@ -2476,9 +2476,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.UpdateCmekSettingsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Call the update cmek settings method over HTTP. @@ -2584,9 +2584,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.UpdateExclusionRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Call the update exclusion method over HTTP. @@ -2700,9 +2700,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.UpdateSinkRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Call the update sink method over HTTP. @@ -2834,9 +2834,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_config.UpdateViewRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Call the update view method over HTTP. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py index 2f20f04b9a..1927be3cca 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, AsyncIterable, Awaitable, AsyncIterator, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, AsyncIterable, Awaitable, AsyncIterator, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -140,9 +140,9 @@ def transport(self) -> LoggingServiceV2Transport: get_transport_class = functools.partial(type(LoggingServiceV2Client).get_transport_class, type(LoggingServiceV2Client)) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, LoggingServiceV2Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the logging service v2 client. @@ -186,11 +186,11 @@ def __init__(self, *, ) async def delete_log(self, - request: Union[logging.DeleteLogRequest, dict] = None, + request: Optional[Union[logging.DeleteLogRequest, dict]] = None, *, - log_name: str = None, + log_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes all the log entries in a log. The log @@ -223,7 +223,7 @@ async def sample_delete_log(): await client.delete_log(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]]): The request object. The parameters to DeleteLog. log_name (:class:`str`): Required. The resource name of the log to delete: @@ -298,14 +298,14 @@ async def sample_delete_log(): ) async def write_log_entries(self, - request: Union[logging.WriteLogEntriesRequest, dict] = None, + request: Optional[Union[logging.WriteLogEntriesRequest, dict]] = None, *, - log_name: str = None, - resource: monitored_resource_pb2.MonitoredResource = None, - labels: Mapping[str, str] = None, - entries: Sequence[log_entry.LogEntry] = None, + log_name: Optional[str] = None, + resource: Optional[monitored_resource_pb2.MonitoredResource] = None, + labels: Optional[MutableMapping[str, str]] = None, + entries: Optional[MutableSequence[log_entry.LogEntry]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging.WriteLogEntriesResponse: r"""Writes log entries to Logging. This API method is the @@ -346,7 +346,7 @@ async def sample_write_log_entries(): print(response) Args: - request (Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]]): The request object. The parameters to WriteLogEntries. log_name (:class:`str`): Optional. A default log resource name that is assigned @@ -392,7 +392,7 @@ async def sample_write_log_entries(): This corresponds to the ``resource`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (:class:`Mapping[str, str]`): + labels (:class:`MutableMapping[str, str]`): Optional. Default labels that are added to the ``labels`` field of all log entries in ``entries``. If a log entry already has a label with the same key as a @@ -402,7 +402,7 @@ async def sample_write_log_entries(): This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - entries (:class:`Sequence[google.cloud.logging_v2.types.LogEntry]`): + entries (:class:`MutableSequence[google.cloud.logging_v2.types.LogEntry]`): Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's ``log_name``, ``resource``, @@ -496,13 +496,13 @@ async def sample_write_log_entries(): return response async def list_log_entries(self, - request: Union[logging.ListLogEntriesRequest, dict] = None, + request: Optional[Union[logging.ListLogEntriesRequest, dict]] = None, *, - resource_names: Sequence[str] = None, - filter: str = None, - order_by: str = None, + resource_names: Optional[MutableSequence[str]] = None, + filter: Optional[str] = None, + order_by: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogEntriesAsyncPager: r"""Lists log entries. Use this method to retrieve log entries that @@ -538,9 +538,9 @@ async def sample_list_log_entries(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]]): The request object. The parameters to `ListLogEntries`. - resource_names (:class:`Sequence[str]`): + resource_names (:class:`MutableSequence[str]`): Required. Names of one or more parent resources from which to retrieve log entries: @@ -660,10 +660,10 @@ async def sample_list_log_entries(): return response async def list_monitored_resource_descriptors(self, - request: Union[logging.ListMonitoredResourceDescriptorsRequest, dict] = None, + request: Optional[Union[logging.ListMonitoredResourceDescriptorsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListMonitoredResourceDescriptorsAsyncPager: r"""Lists the descriptors for monitored resource types @@ -696,7 +696,7 @@ async def sample_list_monitored_resource_descriptors(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]]): The request object. The parameters to ListMonitoredResourceDescriptors retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -754,11 +754,11 @@ async def sample_list_monitored_resource_descriptors(): return response async def list_logs(self, - request: Union[logging.ListLogsRequest, dict] = None, + request: Optional[Union[logging.ListLogsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogsAsyncPager: r"""Lists the logs in projects, organizations, folders, @@ -793,7 +793,7 @@ async def sample_list_logs(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListLogsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListLogsRequest, dict]]): The request object. The parameters to ListLogs. parent (:class:`str`): Required. The resource name that owns the logs: @@ -882,10 +882,10 @@ async def sample_list_logs(): return response def tail_log_entries(self, - requests: AsyncIterator[logging.TailLogEntriesRequest] = None, + requests: Optional[AsyncIterator[logging.TailLogEntriesRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[logging.TailLogEntriesResponse]]: r"""Streaming read of log entries as they are ingested. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py index e9a1f7ba4c..a3db9d9813 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Iterable, Iterator, Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Iterable, Iterator, Sequence, Tuple, Type, Union, cast import pkg_resources from google.api_core import client_options as client_options_lib @@ -57,7 +57,7 @@ class LoggingServiceV2ClientMeta(type): _transport_registry["rest"] = LoggingServiceV2RestTransport def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[LoggingServiceV2Transport]: """Returns an appropriate transport class. @@ -290,7 +290,7 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, LoggingServiceV2Transport, None] = None, + transport: Optional[Union[str, LoggingServiceV2Transport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -380,11 +380,11 @@ def __init__(self, *, ) def delete_log(self, - request: Union[logging.DeleteLogRequest, dict] = None, + request: Optional[Union[logging.DeleteLogRequest, dict]] = None, *, - log_name: str = None, + log_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes all the log entries in a log. The log @@ -484,14 +484,14 @@ def sample_delete_log(): ) def write_log_entries(self, - request: Union[logging.WriteLogEntriesRequest, dict] = None, + request: Optional[Union[logging.WriteLogEntriesRequest, dict]] = None, *, - log_name: str = None, - resource: monitored_resource_pb2.MonitoredResource = None, - labels: Mapping[str, str] = None, - entries: Sequence[log_entry.LogEntry] = None, + log_name: Optional[str] = None, + resource: Optional[monitored_resource_pb2.MonitoredResource] = None, + labels: Optional[MutableMapping[str, str]] = None, + entries: Optional[MutableSequence[log_entry.LogEntry]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging.WriteLogEntriesResponse: r"""Writes log entries to Logging. This API method is the @@ -578,7 +578,7 @@ def sample_write_log_entries(): This corresponds to the ``resource`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Optional. Default labels that are added to the ``labels`` field of all log entries in ``entries``. If a log entry already has a label with the same key as a @@ -588,7 +588,7 @@ def sample_write_log_entries(): This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's ``log_name``, ``resource``, @@ -673,13 +673,13 @@ def sample_write_log_entries(): return response def list_log_entries(self, - request: Union[logging.ListLogEntriesRequest, dict] = None, + request: Optional[Union[logging.ListLogEntriesRequest, dict]] = None, *, - resource_names: Sequence[str] = None, - filter: str = None, - order_by: str = None, + resource_names: Optional[MutableSequence[str]] = None, + filter: Optional[str] = None, + order_by: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogEntriesPager: r"""Lists log entries. Use this method to retrieve log entries that @@ -717,7 +717,7 @@ def sample_list_log_entries(): Args: request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]): The request object. The parameters to `ListLogEntries`. - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Required. Names of one or more parent resources from which to retrieve log entries: @@ -829,10 +829,10 @@ def sample_list_log_entries(): return response def list_monitored_resource_descriptors(self, - request: Union[logging.ListMonitoredResourceDescriptorsRequest, dict] = None, + request: Optional[Union[logging.ListMonitoredResourceDescriptorsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListMonitoredResourceDescriptorsPager: r"""Lists the descriptors for monitored resource types @@ -916,11 +916,11 @@ def sample_list_monitored_resource_descriptors(): return response def list_logs(self, - request: Union[logging.ListLogsRequest, dict] = None, + request: Optional[Union[logging.ListLogsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogsPager: r"""Lists the logs in projects, organizations, folders, @@ -1036,10 +1036,10 @@ def sample_list_logs(): return response def tail_log_entries(self, - requests: Iterator[logging.TailLogEntriesRequest] = None, + requests: Optional[Iterator[logging.TailLogEntriesRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> Iterable[logging.TailLogEntriesResponse]: r"""Streaming read of log entries as they are ingested. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/base.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/base.py index 63a61cf7de..75bf314629 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/base.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/base.py @@ -53,7 +53,7 @@ class LoggingServiceV2Transport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py index 6e19b459b1..6f6b9a4fe6 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py @@ -45,14 +45,14 @@ class LoggingServiceV2GrpcTransport(LoggingServiceV2Transport): def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -178,8 +178,8 @@ def __init__(self, *, @classmethod def create_channel(cls, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py index e4098c8b1e..8d9c613a67 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class LoggingServiceV2GrpcAsyncIOTransport(LoggingServiceV2Transport): @classmethod def create_channel(cls, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -89,15 +89,15 @@ def create_channel(cls, def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py index 5a12926f94..a735292d92 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py @@ -203,15 +203,15 @@ class LoggingServiceV2RestTransport(LoggingServiceV2Transport): def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[LoggingServiceV2RestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -290,9 +290,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging.DeleteLogRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the delete log method over HTTP. @@ -370,9 +370,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging.ListLogEntriesRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging.ListLogEntriesResponse: r"""Call the list log entries method over HTTP. @@ -455,9 +455,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging.ListLogsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging.ListLogsResponse: r"""Call the list logs method over HTTP. @@ -540,9 +540,9 @@ def __hash__(self): def __call__(self, request: logging.ListMonitoredResourceDescriptorsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging.ListMonitoredResourceDescriptorsResponse: r"""Call the list monitored resource descriptors method over HTTP. @@ -613,9 +613,9 @@ def __hash__(self): def __call__(self, request: logging.TailLogEntriesRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Client streaming over REST is not yet defined for python client") @@ -633,9 +633,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging.WriteLogEntriesRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging.WriteLogEntriesResponse: r"""Call the write log entries method over HTTP. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py index a64b92d72f..54bc33ba5c 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -141,9 +141,9 @@ def transport(self) -> MetricsServiceV2Transport: get_transport_class = functools.partial(type(MetricsServiceV2Client).get_transport_class, type(MetricsServiceV2Client)) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, MetricsServiceV2Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the metrics service v2 client. @@ -187,11 +187,11 @@ def __init__(self, *, ) async def list_log_metrics(self, - request: Union[logging_metrics.ListLogMetricsRequest, dict] = None, + request: Optional[Union[logging_metrics.ListLogMetricsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogMetricsAsyncPager: r"""Lists logs-based metrics. @@ -224,7 +224,7 @@ async def sample_list_log_metrics(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]]): The request object. The parameters to ListLogMetrics. parent (:class:`str`): Required. The name of the project containing the @@ -311,11 +311,11 @@ async def sample_list_log_metrics(): return response async def get_log_metric(self, - request: Union[logging_metrics.GetLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.GetLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Gets a logs-based metric. @@ -347,7 +347,7 @@ async def sample_get_log_metric(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]]): The request object. The parameters to GetLogMetric. metric_name (:class:`str`): Required. The resource name of the desired metric: @@ -431,12 +431,12 @@ async def sample_get_log_metric(): return response async def create_log_metric(self, - request: Union[logging_metrics.CreateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.CreateLogMetricRequest, dict]] = None, *, - parent: str = None, - metric: logging_metrics.LogMetric = None, + parent: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates a logs-based metric. @@ -473,7 +473,7 @@ async def sample_create_log_metric(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]]): The request object. The parameters to CreateLogMetric. parent (:class:`str`): Required. The resource name of the project in which to @@ -562,12 +562,12 @@ async def sample_create_log_metric(): return response async def update_log_metric(self, - request: Union[logging_metrics.UpdateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.UpdateLogMetricRequest, dict]] = None, *, - metric_name: str = None, - metric: logging_metrics.LogMetric = None, + metric_name: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates or updates a logs-based metric. @@ -604,7 +604,7 @@ async def sample_update_log_metric(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]]): The request object. The parameters to UpdateLogMetric. metric_name (:class:`str`): Required. The resource name of the metric to update: @@ -700,11 +700,11 @@ async def sample_update_log_metric(): return response async def delete_log_metric(self, - request: Union[logging_metrics.DeleteLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.DeleteLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a logs-based metric. @@ -733,7 +733,7 @@ async def sample_delete_log_metric(): await client.delete_log_metric(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]]): The request object. The parameters to DeleteLogMetric. metric_name (:class:`str`): Required. The resource name of the metric to delete: diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py index b4a5c2cddb..fc7b586d79 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast import pkg_resources from google.api_core import client_options as client_options_lib @@ -58,7 +58,7 @@ class MetricsServiceV2ClientMeta(type): _transport_registry["rest"] = MetricsServiceV2RestTransport def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[MetricsServiceV2Transport]: """Returns an appropriate transport class. @@ -291,7 +291,7 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, MetricsServiceV2Transport, None] = None, + transport: Optional[Union[str, MetricsServiceV2Transport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -381,11 +381,11 @@ def __init__(self, *, ) def list_log_metrics(self, - request: Union[logging_metrics.ListLogMetricsRequest, dict] = None, + request: Optional[Union[logging_metrics.ListLogMetricsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogMetricsPager: r"""Lists logs-based metrics. @@ -497,11 +497,11 @@ def sample_list_log_metrics(): return response def get_log_metric(self, - request: Union[logging_metrics.GetLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.GetLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Gets a logs-based metric. @@ -609,12 +609,12 @@ def sample_get_log_metric(): return response def create_log_metric(self, - request: Union[logging_metrics.CreateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.CreateLogMetricRequest, dict]] = None, *, - parent: str = None, - metric: logging_metrics.LogMetric = None, + parent: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates a logs-based metric. @@ -740,12 +740,12 @@ def sample_create_log_metric(): return response def update_log_metric(self, - request: Union[logging_metrics.UpdateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.UpdateLogMetricRequest, dict]] = None, *, - metric_name: str = None, - metric: logging_metrics.LogMetric = None, + metric_name: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates or updates a logs-based metric. @@ -870,11 +870,11 @@ def sample_update_log_metric(): return response def delete_log_metric(self, - request: Union[logging_metrics.DeleteLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.DeleteLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a logs-based metric. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py index 0f1ef810ee..2aa2b3e768 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py @@ -53,7 +53,7 @@ class MetricsServiceV2Transport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py index abe1685b13..8ce93312c7 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py @@ -45,14 +45,14 @@ class MetricsServiceV2GrpcTransport(MetricsServiceV2Transport): def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -178,8 +178,8 @@ def __init__(self, *, @classmethod def create_channel(cls, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py index ce1d083c4c..bdc1159475 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class MetricsServiceV2GrpcAsyncIOTransport(MetricsServiceV2Transport): @classmethod def create_channel(cls, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -89,15 +89,15 @@ def create_channel(cls, def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py index c549623f5f..d892b5d297 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py @@ -203,15 +203,15 @@ class MetricsServiceV2RestTransport(MetricsServiceV2Transport): def __init__(self, *, host: str = 'logging.googleapis.com', - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[MetricsServiceV2RestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -290,9 +290,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_metrics.CreateLogMetricRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Call the create log metric method over HTTP. @@ -386,9 +386,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_metrics.DeleteLogMetricRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ): r"""Call the delete log metric method over HTTP. @@ -450,9 +450,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_metrics.GetLogMetricRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Call the get log metric method over HTTP. @@ -537,9 +537,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_metrics.ListLogMetricsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.ListLogMetricsResponse: r"""Call the list log metrics method over HTTP. @@ -613,9 +613,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: logging_metrics.UpdateLogMetricRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Call the update log metric method over HTTP. diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/types/log_entry.py b/tests/integration/goldens/logging/google/cloud/logging_v2/types/log_entry.py index f6a4c1d3ac..a0a5cc98a9 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/types/log_entry.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/types/log_entry.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.api import monitored_resource_pb2 # type: ignore @@ -142,7 +144,7 @@ class LogEntry(proto.Message): http_request (google.logging.type.http_request_pb2.HttpRequest): Optional. Information about the HTTP request associated with this log entry, if applicable. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Optional. A set of user-defined (key, value) data that provides additional information about the log entry. @@ -177,79 +179,79 @@ class LogEntry(proto.Message): associated with the log entry, if any. """ - log_name = proto.Field( + log_name: str = proto.Field( proto.STRING, number=12, ) - resource = proto.Field( + resource: monitored_resource_pb2.MonitoredResource = proto.Field( proto.MESSAGE, number=8, message=monitored_resource_pb2.MonitoredResource, ) - proto_payload = proto.Field( + proto_payload: any_pb2.Any = proto.Field( proto.MESSAGE, number=2, oneof='payload', message=any_pb2.Any, ) - text_payload = proto.Field( + text_payload: str = proto.Field( proto.STRING, number=3, oneof='payload', ) - json_payload = proto.Field( + json_payload: struct_pb2.Struct = proto.Field( proto.MESSAGE, number=6, oneof='payload', message=struct_pb2.Struct, ) - timestamp = proto.Field( + timestamp: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp, ) - receive_timestamp = proto.Field( + receive_timestamp: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=24, message=timestamp_pb2.Timestamp, ) - severity = proto.Field( + severity: log_severity_pb2.LogSeverity = proto.Field( proto.ENUM, number=10, enum=log_severity_pb2.LogSeverity, ) - insert_id = proto.Field( + insert_id: str = proto.Field( proto.STRING, number=4, ) - http_request = proto.Field( + http_request: http_request_pb2.HttpRequest = proto.Field( proto.MESSAGE, number=7, message=http_request_pb2.HttpRequest, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=11, ) - operation = proto.Field( + operation: 'LogEntryOperation' = proto.Field( proto.MESSAGE, number=15, message='LogEntryOperation', ) - trace = proto.Field( + trace: str = proto.Field( proto.STRING, number=22, ) - span_id = proto.Field( + span_id: str = proto.Field( proto.STRING, number=27, ) - trace_sampled = proto.Field( + trace_sampled: bool = proto.Field( proto.BOOL, number=30, ) - source_location = proto.Field( + source_location: 'LogEntrySourceLocation' = proto.Field( proto.MESSAGE, number=23, message='LogEntrySourceLocation', @@ -278,19 +280,19 @@ class LogEntryOperation(proto.Message): last log entry in the operation. """ - id = proto.Field( + id: str = proto.Field( proto.STRING, number=1, ) - producer = proto.Field( + producer: str = proto.Field( proto.STRING, number=2, ) - first = proto.Field( + first: bool = proto.Field( proto.BOOL, number=3, ) - last = proto.Field( + last: bool = proto.Field( proto.BOOL, number=4, ) @@ -318,15 +320,15 @@ class LogEntrySourceLocation(proto.Message): (Go), ``function`` (Python). """ - file = proto.Field( + file: str = proto.Field( proto.STRING, number=1, ) - line = proto.Field( + line: int = proto.Field( proto.INT64, number=2, ) - function = proto.Field( + function: str = proto.Field( proto.STRING, number=3, ) diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging.py b/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging.py index f6073b02a4..0d1b9779ac 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.api import monitored_resource_pb2 # type: ignore @@ -61,7 +63,7 @@ class DeleteLogRequest(proto.Message): [LogEntry][google.logging.v2.LogEntry]. """ - log_name = proto.Field( + log_name: str = proto.Field( proto.STRING, number=1, ) @@ -106,13 +108,13 @@ class WriteLogEntriesRequest(proto.Message): "zone": "us-central1-a", "instance_id": "00000000000000000000" }} See [LogEntry][google.logging.v2.LogEntry]. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Optional. Default labels that are added to the ``labels`` field of all log entries in ``entries``. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See [LogEntry][google.logging.v2.LogEntry]. - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's ``log_name``, ``resource``, and ``labels`` @@ -158,30 +160,30 @@ class WriteLogEntriesRequest(proto.Message): properly before sending valuable data. """ - log_name = proto.Field( + log_name: str = proto.Field( proto.STRING, number=1, ) - resource = proto.Field( + resource: monitored_resource_pb2.MonitoredResource = proto.Field( proto.MESSAGE, number=2, message=monitored_resource_pb2.MonitoredResource, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=3, ) - entries = proto.RepeatedField( + entries: MutableSequence[log_entry.LogEntry] = proto.RepeatedField( proto.MESSAGE, number=4, message=log_entry.LogEntry, ) - partial_success = proto.Field( + partial_success: bool = proto.Field( proto.BOOL, number=5, ) - dry_run = proto.Field( + dry_run: bool = proto.Field( proto.BOOL, number=6, ) @@ -196,7 +198,7 @@ class WriteLogEntriesPartialErrors(proto.Message): r"""Error details for WriteLogEntries with partial success. Attributes: - log_entry_errors (Mapping[int, google.rpc.status_pb2.Status]): + log_entry_errors (MutableMapping[int, google.rpc.status_pb2.Status]): When ``WriteLogEntriesRequest.partial_success`` is true, records the error status for entries that were not written due to a permanent error, keyed by the entry's zero-based @@ -206,7 +208,7 @@ class WriteLogEntriesPartialErrors(proto.Message): include per-entry errors. """ - log_entry_errors = proto.MapField( + log_entry_errors: MutableMapping[int, status_pb2.Status] = proto.MapField( proto.INT32, proto.MESSAGE, number=1, @@ -218,7 +220,7 @@ class ListLogEntriesRequest(proto.Message): r"""The parameters to ``ListLogEntries``. Attributes: - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Required. Names of one or more parent resources from which to retrieve log entries: @@ -270,23 +272,23 @@ class ListLogEntriesRequest(proto.Message): should be identical to those in the previous call. """ - resource_names = proto.RepeatedField( + resource_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=8, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=3, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=4, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=5, ) @@ -296,7 +298,7 @@ class ListLogEntriesResponse(proto.Message): r"""Result returned from ``ListLogEntries``. Attributes: - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): A list of log entries. If ``entries`` is empty, ``nextPageToken`` may still be returned, indicating that more entries may exist. See ``nextPageToken`` for more @@ -321,12 +323,12 @@ class ListLogEntriesResponse(proto.Message): def raw_page(self): return self - entries = proto.RepeatedField( + entries: MutableSequence[log_entry.LogEntry] = proto.RepeatedField( proto.MESSAGE, number=1, message=log_entry.LogEntry, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -349,11 +351,11 @@ class ListMonitoredResourceDescriptorsRequest(proto.Message): should be identical to those in the previous call. """ - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) @@ -363,7 +365,7 @@ class ListMonitoredResourceDescriptorsResponse(proto.Message): r"""Result returned from ListMonitoredResourceDescriptors. Attributes: - resource_descriptors (Sequence[google.api.monitored_resource_pb2.MonitoredResourceDescriptor]): + resource_descriptors (MutableSequence[google.api.monitored_resource_pb2.MonitoredResourceDescriptor]): A list of resource descriptors. next_page_token (str): If there might be more results than those appearing in this @@ -376,12 +378,12 @@ class ListMonitoredResourceDescriptorsResponse(proto.Message): def raw_page(self): return self - resource_descriptors = proto.RepeatedField( + resource_descriptors: MutableSequence[monitored_resource_pb2.MonitoredResourceDescriptor] = proto.RepeatedField( proto.MESSAGE, number=1, message=monitored_resource_pb2.MonitoredResourceDescriptor, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -411,7 +413,7 @@ class ListLogsRequest(proto.Message): ``pageToken`` must be the value of ``nextPageToken`` from the previous response. The values of other method parameters should be identical to those in the previous call. - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Optional. The resource name that owns the logs: projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID] organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID] @@ -423,19 +425,19 @@ class ListLogsRequest(proto.Message): "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]". """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - resource_names = proto.RepeatedField( + resource_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=8, ) @@ -445,7 +447,7 @@ class ListLogsResponse(proto.Message): r"""Result returned from ListLogs. Attributes: - log_names (Sequence[str]): + log_names (MutableSequence[str]): A list of log names. For example, ``"projects/my-project/logs/syslog"`` or ``"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"``. @@ -460,11 +462,11 @@ class ListLogsResponse(proto.Message): def raw_page(self): return self - log_names = proto.RepeatedField( + log_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -474,7 +476,7 @@ class TailLogEntriesRequest(proto.Message): r"""The parameters to ``TailLogEntries``. Attributes: - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Required. Name of a parent resource from which to retrieve log entries: @@ -509,15 +511,15 @@ class TailLogEntriesRequest(proto.Message): milliseconds. """ - resource_names = proto.RepeatedField( + resource_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - buffer_window = proto.Field( + buffer_window: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=3, message=duration_pb2.Duration, @@ -528,12 +530,12 @@ class TailLogEntriesResponse(proto.Message): r"""Result returned from ``TailLogEntries``. Attributes: - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): A list of log entries. Each response in the stream will order entries with increasing values of ``LogEntry.timestamp``. Ordering is not guaranteed between separate responses. - suppression_info (Sequence[google.cloud.logging_v2.types.TailLogEntriesResponse.SuppressionInfo]): + suppression_info (MutableSequence[google.cloud.logging_v2.types.TailLogEntriesResponse.SuppressionInfo]): If entries that otherwise would have been included in the session were not sent back to the client, counts of relevant entries omitted @@ -561,22 +563,22 @@ class Reason(proto.Enum): RATE_LIMIT = 1 NOT_CONSUMED = 2 - reason = proto.Field( + reason: 'TailLogEntriesResponse.SuppressionInfo.Reason' = proto.Field( proto.ENUM, number=1, enum='TailLogEntriesResponse.SuppressionInfo.Reason', ) - suppressed_count = proto.Field( + suppressed_count: int = proto.Field( proto.INT32, number=2, ) - entries = proto.RepeatedField( + entries: MutableSequence[log_entry.LogEntry] = proto.RepeatedField( proto.MESSAGE, number=1, message=log_entry.LogEntry, ) - suppression_info = proto.RepeatedField( + suppression_info: MutableSequence[SuppressionInfo] = proto.RepeatedField( proto.MESSAGE, number=2, message=SuppressionInfo, diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_config.py b/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_config.py index 1fd81ef433..4eb3b13afd 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_config.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_config.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.protobuf import field_mask_pb2 # type: ignore @@ -104,33 +106,33 @@ class LogBucket(proto.Message): Output only. The bucket lifecycle state. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - retention_days = proto.Field( + retention_days: int = proto.Field( proto.INT32, number=11, ) - locked = proto.Field( + locked: bool = proto.Field( proto.BOOL, number=9, ) - lifecycle_state = proto.Field( + lifecycle_state: 'LifecycleState' = proto.Field( proto.ENUM, number=12, enum='LifecycleState', @@ -162,25 +164,25 @@ class LogView(proto.Message): resource.type = "gce_instance" AND LOG_ID("stdout") """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=7, ) @@ -236,7 +238,7 @@ class LogSink(proto.Message): disabled (bool): Optional. If set to True, then this sink is disabled and it does not export any log entries. - exclusions (Sequence[google.cloud.logging_v2.types.LogExclusion]): + exclusions (MutableSequence[google.cloud.logging_v2.types.LogExclusion]): Optional. Log entries that match any of the exclusion filters will not be exported. If a log entry is matched by both ``filter`` and one of ``exclusion_filters`` it will not @@ -298,56 +300,56 @@ class VersionFormat(proto.Enum): V2 = 1 V1 = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - destination = proto.Field( + destination: str = proto.Field( proto.STRING, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=5, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=18, ) - disabled = proto.Field( + disabled: bool = proto.Field( proto.BOOL, number=19, ) - exclusions = proto.RepeatedField( + exclusions: MutableSequence['LogExclusion'] = proto.RepeatedField( proto.MESSAGE, number=16, message='LogExclusion', ) - output_version_format = proto.Field( + output_version_format: VersionFormat = proto.Field( proto.ENUM, number=6, enum=VersionFormat, ) - writer_identity = proto.Field( + writer_identity: str = proto.Field( proto.STRING, number=8, ) - include_children = proto.Field( + include_children: bool = proto.Field( proto.BOOL, number=9, ) - bigquery_options = proto.Field( + bigquery_options: 'BigQueryOptions' = proto.Field( proto.MESSAGE, number=12, oneof='options', message='BigQueryOptions', ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=13, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=14, message=timestamp_pb2.Timestamp, @@ -379,11 +381,11 @@ class BigQueryOptions(proto.Message): will have this field set to false. """ - use_partitioned_tables = proto.Field( + use_partitioned_tables: bool = proto.Field( proto.BOOL, number=1, ) - uses_timestamp_column_partitioning = proto.Field( + uses_timestamp_column_partitioning: bool = proto.Field( proto.BOOL, number=3, ) @@ -420,15 +422,15 @@ class ListBucketsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -438,7 +440,7 @@ class ListBucketsResponse(proto.Message): r"""The response from ListBuckets. Attributes: - buckets (Sequence[google.cloud.logging_v2.types.LogBucket]): + buckets (MutableSequence[google.cloud.logging_v2.types.LogBucket]): A list of buckets. next_page_token (str): If there might be more results than appear in this response, @@ -451,12 +453,12 @@ class ListBucketsResponse(proto.Message): def raw_page(self): return self - buckets = proto.RepeatedField( + buckets: MutableSequence['LogBucket'] = proto.RepeatedField( proto.MESSAGE, number=1, message='LogBucket', ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -486,15 +488,15 @@ class CreateBucketRequest(proto.Message): name field in the bucket is ignored. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - bucket_id = proto.Field( + bucket_id: str = proto.Field( proto.STRING, number=2, ) - bucket = proto.Field( + bucket: 'LogBucket' = proto.Field( proto.MESSAGE, number=3, message='LogBucket', @@ -534,16 +536,16 @@ class UpdateBucketRequest(proto.Message): Example: ``updateMask=retention_days``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - bucket = proto.Field( + bucket: 'LogBucket' = proto.Field( proto.MESSAGE, number=2, message='LogBucket', ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, @@ -568,7 +570,7 @@ class GetBucketRequest(proto.Message): ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -592,7 +594,7 @@ class DeleteBucketRequest(proto.Message): ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -616,7 +618,7 @@ class UndeleteBucketRequest(proto.Message): ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -645,15 +647,15 @@ class ListViewsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -663,7 +665,7 @@ class ListViewsResponse(proto.Message): r"""The response from ListViews. Attributes: - views (Sequence[google.cloud.logging_v2.types.LogView]): + views (MutableSequence[google.cloud.logging_v2.types.LogView]): A list of views. next_page_token (str): If there might be more results than appear in this response, @@ -676,12 +678,12 @@ class ListViewsResponse(proto.Message): def raw_page(self): return self - views = proto.RepeatedField( + views: MutableSequence['LogView'] = proto.RepeatedField( proto.MESSAGE, number=1, message='LogView', ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -706,15 +708,15 @@ class CreateViewRequest(proto.Message): Required. The new view. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - view_id = proto.Field( + view_id: str = proto.Field( proto.STRING, number=2, ) - view = proto.Field( + view: 'LogView' = proto.Field( proto.MESSAGE, number=3, message='LogView', @@ -748,16 +750,16 @@ class UpdateViewRequest(proto.Message): Example: ``updateMask=filter``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: 'LogView' = proto.Field( proto.MESSAGE, number=2, message='LogView', ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, @@ -779,7 +781,7 @@ class GetViewRequest(proto.Message): ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -800,7 +802,7 @@ class DeleteViewRequest(proto.Message): ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -832,15 +834,15 @@ class ListSinksRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -850,7 +852,7 @@ class ListSinksResponse(proto.Message): r"""Result returned from ``ListSinks``. Attributes: - sinks (Sequence[google.cloud.logging_v2.types.LogSink]): + sinks (MutableSequence[google.cloud.logging_v2.types.LogSink]): A list of sinks. next_page_token (str): If there might be more results than appear in this response, @@ -863,12 +865,12 @@ class ListSinksResponse(proto.Message): def raw_page(self): return self - sinks = proto.RepeatedField( + sinks: MutableSequence['LogSink'] = proto.RepeatedField( proto.MESSAGE, number=1, message='LogSink', ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -891,7 +893,7 @@ class GetSinkRequest(proto.Message): Example: ``"projects/my-project-id/sinks/my-sink-id"``. """ - sink_name = proto.Field( + sink_name: str = proto.Field( proto.STRING, number=1, ) @@ -933,16 +935,16 @@ class CreateSinkRequest(proto.Message): [LogSink][google.logging.v2.LogSink]. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - sink = proto.Field( + sink: 'LogSink' = proto.Field( proto.MESSAGE, number=2, message='LogSink', ) - unique_writer_identity = proto.Field( + unique_writer_identity: bool = proto.Field( proto.BOOL, number=3, ) @@ -1001,20 +1003,20 @@ class UpdateSinkRequest(proto.Message): Example: ``updateMask=filter``. """ - sink_name = proto.Field( + sink_name: str = proto.Field( proto.STRING, number=1, ) - sink = proto.Field( + sink: 'LogSink' = proto.Field( proto.MESSAGE, number=2, message='LogSink', ) - unique_writer_identity = proto.Field( + unique_writer_identity: bool = proto.Field( proto.BOOL, number=3, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, @@ -1039,7 +1041,7 @@ class DeleteSinkRequest(proto.Message): Example: ``"projects/my-project-id/sinks/my-sink-id"``. """ - sink_name = proto.Field( + sink_name: str = proto.Field( proto.STRING, number=1, ) @@ -1091,28 +1093,28 @@ class LogExclusion(proto.Message): exclusions. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=3, ) - disabled = proto.Field( + disabled: bool = proto.Field( proto.BOOL, number=4, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, @@ -1146,15 +1148,15 @@ class ListExclusionsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -1164,7 +1166,7 @@ class ListExclusionsResponse(proto.Message): r"""Result returned from ``ListExclusions``. Attributes: - exclusions (Sequence[google.cloud.logging_v2.types.LogExclusion]): + exclusions (MutableSequence[google.cloud.logging_v2.types.LogExclusion]): A list of exclusions. next_page_token (str): If there might be more results than appear in this response, @@ -1177,12 +1179,12 @@ class ListExclusionsResponse(proto.Message): def raw_page(self): return self - exclusions = proto.RepeatedField( + exclusions: MutableSequence['LogExclusion'] = proto.RepeatedField( proto.MESSAGE, number=1, message='LogExclusion', ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1206,7 +1208,7 @@ class GetExclusionRequest(proto.Message): ``"projects/my-project-id/exclusions/my-exclusion-id"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1235,11 +1237,11 @@ class CreateExclusionRequest(proto.Message): resource. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - exclusion = proto.Field( + exclusion: 'LogExclusion' = proto.Field( proto.MESSAGE, number=2, message='LogExclusion', @@ -1278,16 +1280,16 @@ class UpdateExclusionRequest(proto.Message): ``"filter,description"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - exclusion = proto.Field( + exclusion: 'LogExclusion' = proto.Field( proto.MESSAGE, number=2, message='LogExclusion', ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -1313,7 +1315,7 @@ class DeleteExclusionRequest(proto.Message): ``"projects/my-project-id/exclusions/my-exclusion-id"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1345,7 +1347,7 @@ class GetCmekSettingsRequest(proto.Message): applies to all projects and folders in the GCP organization. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1393,16 +1395,16 @@ class UpdateCmekSettingsRequest(proto.Message): Example: ``"updateMask=kmsKeyName"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - cmek_settings = proto.Field( + cmek_settings: 'CmekSettings' = proto.Field( proto.MESSAGE, number=2, message='CmekSettings', ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -1471,15 +1473,15 @@ class CmekSettings(proto.Message): for more information. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - kms_key_name = proto.Field( + kms_key_name: str = proto.Field( proto.STRING, number=2, ) - service_account_id = proto.Field( + service_account_id: str = proto.Field( proto.STRING, number=3, ) diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_metrics.py b/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_metrics.py index c39349904e..6b34228d58 100644 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_metrics.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/types/logging_metrics.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.api import distribution_pb2 # type: ignore @@ -125,7 +127,7 @@ class LogMetric(proto.Message): Example: ``REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")`` - label_extractors (Mapping[str, str]): + label_extractors (MutableMapping[str, str]): Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key @@ -166,48 +168,48 @@ class ApiVersion(proto.Enum): V2 = 0 V1 = 1 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=3, ) - metric_descriptor = proto.Field( + metric_descriptor: metric_pb2.MetricDescriptor = proto.Field( proto.MESSAGE, number=5, message=metric_pb2.MetricDescriptor, ) - value_extractor = proto.Field( + value_extractor: str = proto.Field( proto.STRING, number=6, ) - label_extractors = proto.MapField( + label_extractors: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=7, ) - bucket_options = proto.Field( + bucket_options: distribution_pb2.Distribution.BucketOptions = proto.Field( proto.MESSAGE, number=8, message=distribution_pb2.Distribution.BucketOptions, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, ) - version = proto.Field( + version: ApiVersion = proto.Field( proto.ENUM, number=4, enum=ApiVersion, @@ -237,15 +239,15 @@ class ListLogMetricsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -255,7 +257,7 @@ class ListLogMetricsResponse(proto.Message): r"""Result returned from ListLogMetrics. Attributes: - metrics (Sequence[google.cloud.logging_v2.types.LogMetric]): + metrics (MutableSequence[google.cloud.logging_v2.types.LogMetric]): A list of logs-based metrics. next_page_token (str): If there might be more results than appear in this response, @@ -268,12 +270,12 @@ class ListLogMetricsResponse(proto.Message): def raw_page(self): return self - metrics = proto.RepeatedField( + metrics: MutableSequence['LogMetric'] = proto.RepeatedField( proto.MESSAGE, number=1, message='LogMetric', ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -291,7 +293,7 @@ class GetLogMetricRequest(proto.Message): "projects/[PROJECT_ID]/metrics/[METRIC_ID]". """ - metric_name = proto.Field( + metric_name: str = proto.Field( proto.STRING, number=1, ) @@ -315,11 +317,11 @@ class CreateLogMetricRequest(proto.Message): must not have an identifier that already exists. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - metric = proto.Field( + metric: 'LogMetric' = proto.Field( proto.MESSAGE, number=2, message='LogMetric', @@ -345,11 +347,11 @@ class UpdateLogMetricRequest(proto.Message): Required. The updated metric. """ - metric_name = proto.Field( + metric_name: str = proto.Field( proto.STRING, number=1, ) - metric = proto.Field( + metric: 'LogMetric' = proto.Field( proto.MESSAGE, number=2, message='LogMetric', @@ -368,7 +370,7 @@ class DeleteLogMetricRequest(proto.Message): "projects/[PROJECT_ID]/metrics/[METRIC_ID]". """ - metric_name = proto.Field( + metric_name: str = proto.Field( proto.STRING, number=1, ) diff --git a/tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_google.logging.v2.json b/tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_google.logging.v2.json index 78f6e43dbb..cf16dded69 100644 --- a/tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_google.logging.v2.json +++ b/tests/integration/goldens/logging/samples/generated_samples/snippet_metadata_google.logging.v2.json @@ -3823,7 +3823,7 @@ }, { "name": "resource_names", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "filter", @@ -3911,7 +3911,7 @@ }, { "name": "resource_names", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "filter", @@ -4475,11 +4475,11 @@ }, { "name": "labels", - "type": "Mapping[str, str]" + "type": "MutableMapping[str, str]" }, { "name": "entries", - "type": "Sequence[google.cloud.logging_v2.types.LogEntry]" + "type": "MutableSequence[google.cloud.logging_v2.types.LogEntry]" }, { "name": "retry", @@ -4567,11 +4567,11 @@ }, { "name": "labels", - "type": "Mapping[str, str]" + "type": "MutableMapping[str, str]" }, { "name": "entries", - "type": "Sequence[google.cloud.logging_v2.types.LogEntry]" + "type": "MutableSequence[google.cloud.logging_v2.types.LogEntry]" }, { "name": "retry", diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py index d8a9a13b40..7da01bfa47 100755 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -164,9 +164,9 @@ def transport(self) -> CloudRedisTransport: get_transport_class = functools.partial(type(CloudRedisClient).get_transport_class, type(CloudRedisClient)) def __init__(self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, CloudRedisTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the cloud redis client. @@ -210,11 +210,11 @@ def __init__(self, *, ) async def list_instances(self, - request: Union[cloud_redis.ListInstancesRequest, dict] = None, + request: Optional[Union[cloud_redis.ListInstancesRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesAsyncPager: r"""Lists all Redis instances owned by a project in either the @@ -256,7 +256,7 @@ async def sample_list_instances(): print(response) Args: - request (Union[google.cloud.redis_v1.types.ListInstancesRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.ListInstancesRequest, dict]]): The request object. Request for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances]. parent (:class:`str`): @@ -335,11 +335,11 @@ async def sample_list_instances(): return response async def get_instance(self, - request: Union[cloud_redis.GetInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.GetInstanceRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_redis.Instance: r"""Gets the details of a specific Redis instance. @@ -371,7 +371,7 @@ async def sample_get_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.GetInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.GetInstanceRequest, dict]]): The request object. Request for [GetInstance][google.cloud.redis.v1.CloudRedis.GetInstance]. name (:class:`str`): @@ -435,13 +435,13 @@ async def sample_get_instance(): return response async def create_instance(self, - request: Union[cloud_redis.CreateInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.CreateInstanceRequest, dict]] = None, *, - parent: str = None, - instance_id: str = None, - instance: cloud_redis.Instance = None, + parent: Optional[str] = None, + instance_id: Optional[str] = None, + instance: Optional[cloud_redis.Instance] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a Redis instance based on the specified tier and memory @@ -497,7 +497,7 @@ async def sample_create_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.CreateInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.CreateInstanceRequest, dict]]): The request object. Request for [CreateInstance][google.cloud.redis.v1.CloudRedis.CreateInstance]. parent (:class:`str`): @@ -598,12 +598,12 @@ async def sample_create_instance(): return response async def update_instance(self, - request: Union[cloud_redis.UpdateInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.UpdateInstanceRequest, dict]] = None, *, - update_mask: field_mask_pb2.FieldMask = None, - instance: cloud_redis.Instance = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + instance: Optional[cloud_redis.Instance] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the metadata and configuration of a specific @@ -649,7 +649,7 @@ async def sample_update_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.UpdateInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.UpdateInstanceRequest, dict]]): The request object. Request for [UpdateInstance][google.cloud.redis.v1.CloudRedis.UpdateInstance]. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): @@ -741,12 +741,12 @@ async def sample_update_instance(): return response async def upgrade_instance(self, - request: Union[cloud_redis.UpgradeInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.UpgradeInstanceRequest, dict]] = None, *, - name: str = None, - redis_version: str = None, + name: Optional[str] = None, + redis_version: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Upgrades Redis instance to the newer Redis version @@ -784,7 +784,7 @@ async def sample_upgrade_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.UpgradeInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.UpgradeInstanceRequest, dict]]): The request object. Request for [UpgradeInstance][google.cloud.redis.v1.CloudRedis.UpgradeInstance]. name (:class:`str`): @@ -870,12 +870,12 @@ async def sample_upgrade_instance(): return response async def import_instance(self, - request: Union[cloud_redis.ImportInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.ImportInstanceRequest, dict]] = None, *, - name: str = None, - input_config: cloud_redis.InputConfig = None, + name: Optional[str] = None, + input_config: Optional[cloud_redis.InputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Import a Redis RDB snapshot file from Cloud Storage @@ -923,7 +923,7 @@ async def sample_import_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.ImportInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.ImportInstanceRequest, dict]]): The request object. Request for [Import][google.cloud.redis.v1.CloudRedis.ImportInstance]. name (:class:`str`): @@ -1009,12 +1009,12 @@ async def sample_import_instance(): return response async def export_instance(self, - request: Union[cloud_redis.ExportInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.ExportInstanceRequest, dict]] = None, *, - name: str = None, - output_config: cloud_redis.OutputConfig = None, + name: Optional[str] = None, + output_config: Optional[cloud_redis.OutputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Export Redis instance data into a Redis RDB format @@ -1058,7 +1058,7 @@ async def sample_export_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.ExportInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.ExportInstanceRequest, dict]]): The request object. Request for [Export][google.cloud.redis.v1.CloudRedis.ExportInstance]. name (:class:`str`): @@ -1144,12 +1144,12 @@ async def sample_export_instance(): return response async def failover_instance(self, - request: Union[cloud_redis.FailoverInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.FailoverInstanceRequest, dict]] = None, *, - name: str = None, - data_protection_mode: cloud_redis.FailoverInstanceRequest.DataProtectionMode = None, + name: Optional[str] = None, + data_protection_mode: Optional[cloud_redis.FailoverInstanceRequest.DataProtectionMode] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Initiates a failover of the master node to current @@ -1187,7 +1187,7 @@ async def sample_failover_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.FailoverInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.FailoverInstanceRequest, dict]]): The request object. Request for [Failover][google.cloud.redis.v1.CloudRedis.FailoverInstance]. name (:class:`str`): @@ -1274,11 +1274,11 @@ async def sample_failover_instance(): return response async def delete_instance(self, - request: Union[cloud_redis.DeleteInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.DeleteInstanceRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a specific Redis instance. Instance stops @@ -1315,7 +1315,7 @@ async def sample_delete_instance(): print(response) Args: - request (Union[google.cloud.redis_v1.types.DeleteInstanceRequest, dict]): + request (Optional[Union[google.cloud.redis_v1.types.DeleteInstanceRequest, dict]]): The request object. Request for [DeleteInstance][google.cloud.redis.v1.CloudRedis.DeleteInstance]. name (:class:`str`): diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py index 3a1341ac6a..1ddfce8650 100644 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast import pkg_resources from google.api_core import client_options as client_options_lib @@ -60,7 +60,7 @@ class CloudRedisClientMeta(type): _transport_registry["rest"] = CloudRedisRestTransport def get_transport_class(cls, - label: str = None, + label: Optional[str] = None, ) -> Type[CloudRedisTransport]: """Returns an appropriate transport class. @@ -314,7 +314,7 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio def __init__(self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CloudRedisTransport, None] = None, + transport: Optional[Union[str, CloudRedisTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -404,11 +404,11 @@ def __init__(self, *, ) def list_instances(self, - request: Union[cloud_redis.ListInstancesRequest, dict] = None, + request: Optional[Union[cloud_redis.ListInstancesRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesPager: r"""Lists all Redis instances owned by a project in either the @@ -529,11 +529,11 @@ def sample_list_instances(): return response def get_instance(self, - request: Union[cloud_redis.GetInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.GetInstanceRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_redis.Instance: r"""Gets the details of a specific Redis instance. @@ -629,13 +629,13 @@ def sample_get_instance(): return response def create_instance(self, - request: Union[cloud_redis.CreateInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.CreateInstanceRequest, dict]] = None, *, - parent: str = None, - instance_id: str = None, - instance: cloud_redis.Instance = None, + parent: Optional[str] = None, + instance_id: Optional[str] = None, + instance: Optional[cloud_redis.Instance] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates a Redis instance based on the specified tier and memory @@ -792,12 +792,12 @@ def sample_create_instance(): return response def update_instance(self, - request: Union[cloud_redis.UpdateInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.UpdateInstanceRequest, dict]] = None, *, - update_mask: field_mask_pb2.FieldMask = None, - instance: cloud_redis.Instance = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + instance: Optional[cloud_redis.Instance] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Updates the metadata and configuration of a specific @@ -935,12 +935,12 @@ def sample_update_instance(): return response def upgrade_instance(self, - request: Union[cloud_redis.UpgradeInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.UpgradeInstanceRequest, dict]] = None, *, - name: str = None, - redis_version: str = None, + name: Optional[str] = None, + redis_version: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Upgrades Redis instance to the newer Redis version @@ -1064,12 +1064,12 @@ def sample_upgrade_instance(): return response def import_instance(self, - request: Union[cloud_redis.ImportInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.ImportInstanceRequest, dict]] = None, *, - name: str = None, - input_config: cloud_redis.InputConfig = None, + name: Optional[str] = None, + input_config: Optional[cloud_redis.InputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Import a Redis RDB snapshot file from Cloud Storage @@ -1203,12 +1203,12 @@ def sample_import_instance(): return response def export_instance(self, - request: Union[cloud_redis.ExportInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.ExportInstanceRequest, dict]] = None, *, - name: str = None, - output_config: cloud_redis.OutputConfig = None, + name: Optional[str] = None, + output_config: Optional[cloud_redis.OutputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Export Redis instance data into a Redis RDB format @@ -1338,12 +1338,12 @@ def sample_export_instance(): return response def failover_instance(self, - request: Union[cloud_redis.FailoverInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.FailoverInstanceRequest, dict]] = None, *, - name: str = None, - data_protection_mode: cloud_redis.FailoverInstanceRequest.DataProtectionMode = None, + name: Optional[str] = None, + data_protection_mode: Optional[cloud_redis.FailoverInstanceRequest.DataProtectionMode] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Initiates a failover of the master node to current @@ -1468,11 +1468,11 @@ def sample_failover_instance(): return response def delete_instance(self, - request: Union[cloud_redis.DeleteInstanceRequest, dict] = None, + request: Optional[Union[cloud_redis.DeleteInstanceRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes a specific Redis instance. Instance stops diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/base.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/base.py index 5e0e5bd151..7afa097856 100644 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/base.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/base.py @@ -50,7 +50,7 @@ class CloudRedisTransport(abc.ABC): def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc.py index c645f37caf..da987a8f86 100644 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc.py @@ -66,14 +66,14 @@ class CloudRedisGrpcTransport(CloudRedisTransport): def __init__(self, *, host: str = 'redis.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -200,8 +200,8 @@ def __init__(self, *, @classmethod def create_channel(cls, host: str = 'redis.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs) -> grpc.Channel: diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc_asyncio.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc_asyncio.py index c9a27ef42e..0495dbc639 100644 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc_asyncio.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/grpc_asyncio.py @@ -70,7 +70,7 @@ class CloudRedisGrpcAsyncIOTransport(CloudRedisTransport): @classmethod def create_channel(cls, host: str = 'redis.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -110,15 +110,15 @@ def create_channel(cls, def __init__(self, *, host: str = 'redis.googleapis.com', - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py index 2d2c0e9ca3..33f9241386 100755 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py @@ -327,15 +327,15 @@ class CloudRedisRestTransport(CloudRedisTransport): def __init__(self, *, host: str = 'redis.googleapis.com', - credentials: ga_credentials.Credentials=None, - credentials_file: str=None, - scopes: Sequence[str]=None, - client_cert_source_for_mtls: Callable[[ - ], Tuple[bytes, bytes]]=None, - quota_project_id: Optional[str]=None, - client_info: gapic_v1.client_info.ClientInfo=DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool]=False, - url_scheme: str='https', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[ + ], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', interceptor: Optional[CloudRedisRestInterceptor] = None, api_audience: Optional[str] = None, ) -> None: @@ -439,9 +439,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.CreateInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the create instance method over HTTP. @@ -527,9 +527,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.DeleteInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the delete instance method over HTTP. @@ -606,9 +606,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.ExportInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the export instance method over HTTP. @@ -694,9 +694,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.FailoverInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the failover instance method over HTTP. @@ -782,9 +782,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.GetInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_redis.Instance: r"""Call the get instance method over HTTP. @@ -860,9 +860,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.ImportInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the import instance method over HTTP. @@ -948,9 +948,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.ListInstancesRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_redis.ListInstancesResponse: r"""Call the list instances method over HTTP. @@ -1028,9 +1028,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.UpdateInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the update instance method over HTTP. @@ -1116,9 +1116,9 @@ def _get_unset_required_fields(cls, message_dict): def __call__(self, request: cloud_redis.UpgradeInstanceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: float=None, - metadata: Sequence[Tuple[str, str]]=(), + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Call the upgrade instance method over HTTP. diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/types/cloud_redis.py b/tests/integration/goldens/redis/google/cloud/redis_v1/types/cloud_redis.py index bf54ebc15a..c05c497a19 100644 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/types/cloud_redis.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/types/cloud_redis.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.protobuf import field_mask_pb2 # type: ignore @@ -65,7 +67,7 @@ class Instance(proto.Message): display_name (str): An arbitrary and optional user-provided name for the instance. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Resource labels to represent user provided metadata location_id (str): @@ -124,7 +126,7 @@ class Instance(proto.Message): status_message (str): Output only. Additional information about the current status of this instance, if available. - redis_configs (Mapping[str, str]): + redis_configs (MutableMapping[str, str]): Optional. Redis configuration parameters, according to http://redis.io/topics/config. Currently, the only supported parameters are: @@ -188,84 +190,84 @@ class ConnectMode(proto.Enum): DIRECT_PEERING = 1 PRIVATE_SERVICE_ACCESS = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=3, ) - location_id = proto.Field( + location_id: str = proto.Field( proto.STRING, number=4, ) - alternative_location_id = proto.Field( + alternative_location_id: str = proto.Field( proto.STRING, number=5, ) - redis_version = proto.Field( + redis_version: str = proto.Field( proto.STRING, number=7, ) - reserved_ip_range = proto.Field( + reserved_ip_range: str = proto.Field( proto.STRING, number=9, ) - host = proto.Field( + host: str = proto.Field( proto.STRING, number=10, ) - port = proto.Field( + port: int = proto.Field( proto.INT32, number=11, ) - current_location_id = proto.Field( + current_location_id: str = proto.Field( proto.STRING, number=12, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=13, message=timestamp_pb2.Timestamp, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=14, enum=State, ) - status_message = proto.Field( + status_message: str = proto.Field( proto.STRING, number=15, ) - redis_configs = proto.MapField( + redis_configs: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=16, ) - tier = proto.Field( + tier: Tier = proto.Field( proto.ENUM, number=17, enum=Tier, ) - memory_size_gb = proto.Field( + memory_size_gb: int = proto.Field( proto.INT32, number=18, ) - authorized_network = proto.Field( + authorized_network: str = proto.Field( proto.STRING, number=20, ) - persistence_iam_identity = proto.Field( + persistence_iam_identity: str = proto.Field( proto.STRING, number=21, ) - connect_mode = proto.Field( + connect_mode: ConnectMode = proto.Field( proto.ENUM, number=22, enum=ConnectMode, @@ -296,15 +298,15 @@ class ListInstancesRequest(proto.Message): request, if any. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -315,7 +317,7 @@ class ListInstancesResponse(proto.Message): [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances]. Attributes: - instances (Sequence[google.cloud.redis_v1.types.Instance]): + instances (MutableSequence[google.cloud.redis_v1.types.Instance]): A list of Redis instances in the project in the specified location, or across all locations. @@ -332,7 +334,7 @@ class ListInstancesResponse(proto.Message): Token to retrieve the next page of results, or empty if there are no more results in the list. - unreachable (Sequence[str]): + unreachable (MutableSequence[str]): Locations that could not be reached. """ @@ -340,16 +342,16 @@ class ListInstancesResponse(proto.Message): def raw_page(self): return self - instances = proto.RepeatedField( + instances: MutableSequence['Instance'] = proto.RepeatedField( proto.MESSAGE, number=1, message='Instance', ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - unreachable = proto.RepeatedField( + unreachable: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -366,7 +368,7 @@ class GetInstanceRequest(proto.Message): where ``location_id`` refers to a GCP region. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -395,15 +397,15 @@ class CreateInstanceRequest(proto.Message): Required. A Redis [Instance] resource """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - instance_id = proto.Field( + instance_id: str = proto.Field( proto.STRING, number=2, ) - instance = proto.Field( + instance: 'Instance' = proto.Field( proto.MESSAGE, number=3, message='Instance', @@ -430,12 +432,12 @@ class UpdateInstanceRequest(proto.Message): update_mask are updated. """ - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, ) - instance = proto.Field( + instance: 'Instance' = proto.Field( proto.MESSAGE, number=2, message='Instance', @@ -456,11 +458,11 @@ class UpgradeInstanceRequest(proto.Message): Redis software to upgrade to. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - redis_version = proto.Field( + redis_version: str = proto.Field( proto.STRING, number=2, ) @@ -477,7 +479,7 @@ class DeleteInstanceRequest(proto.Message): where ``location_id`` refers to a GCP region. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -492,7 +494,7 @@ class GcsSource(proto.Message): 'gs://my_bucket/my_object'). """ - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, ) @@ -511,7 +513,7 @@ class InputConfig(proto.Message): This field is a member of `oneof`_ ``source``. """ - gcs_source = proto.Field( + gcs_source: 'GcsSource' = proto.Field( proto.MESSAGE, number=1, oneof='source', @@ -532,11 +534,11 @@ class ImportInstanceRequest(proto.Message): Required. Specify data to be imported. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - input_config = proto.Field( + input_config: 'InputConfig' = proto.Field( proto.MESSAGE, number=3, message='InputConfig', @@ -553,7 +555,7 @@ class GcsDestination(proto.Message): overwritten. """ - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, ) @@ -572,7 +574,7 @@ class OutputConfig(proto.Message): This field is a member of `oneof`_ ``destination``. """ - gcs_destination = proto.Field( + gcs_destination: 'GcsDestination' = proto.Field( proto.MESSAGE, number=1, oneof='destination', @@ -593,11 +595,11 @@ class ExportInstanceRequest(proto.Message): Required. Specify data to be exported. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - output_config = proto.Field( + output_config: 'OutputConfig' = proto.Field( proto.MESSAGE, number=3, message='OutputConfig', @@ -626,11 +628,11 @@ class DataProtectionMode(proto.Enum): LIMITED_DATA_LOSS = 1 FORCE_DATA_LOSS = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - data_protection_mode = proto.Field( + data_protection_mode: DataProtectionMode = proto.Field( proto.ENUM, number=2, enum=DataProtectionMode, @@ -658,33 +660,33 @@ class OperationMetadata(proto.Message): API version. """ - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - target = proto.Field( + target: str = proto.Field( proto.STRING, number=3, ) - verb = proto.Field( + verb: str = proto.Field( proto.STRING, number=4, ) - status_detail = proto.Field( + status_detail: str = proto.Field( proto.STRING, number=5, ) - cancel_requested = proto.Field( + cancel_requested: bool = proto.Field( proto.BOOL, number=6, ) - api_version = proto.Field( + api_version: str = proto.Field( proto.STRING, number=7, ) @@ -697,7 +699,7 @@ class LocationMetadata(proto.Message): ``google.cloud.location.Location.metadata`` field. Attributes: - available_zones (Mapping[str, google.cloud.redis_v1.types.ZoneMetadata]): + available_zones (MutableMapping[str, google.cloud.redis_v1.types.ZoneMetadata]): Output only. The set of available zones in the location. The map is keyed by the lowercase ID of each zone, as defined by GCE. These keys can be specified in ``location_id`` or @@ -705,7 +707,7 @@ class LocationMetadata(proto.Message): instance. """ - available_zones = proto.MapField( + available_zones: MutableMapping[str, 'ZoneMetadata'] = proto.MapField( proto.STRING, proto.MESSAGE, number=1, diff --git a/tests/unit/schema/wrappers/test_field.py b/tests/unit/schema/wrappers/test_field.py index f23a2c9d85..7bded119c5 100644 --- a/tests/unit/schema/wrappers/test_field.py +++ b/tests/unit/schema/wrappers/test_field.py @@ -72,7 +72,7 @@ def test_ident(): def test_ident_repeated(): REP = descriptor_pb2.FieldDescriptorProto.Label.Value('LABEL_REPEATED') field = make_field(type='TYPE_BOOL', label=REP) - assert str(field.ident) == 'Sequence[bool]' + assert str(field.ident) == 'MutableSequence[bool]' def test_repeated(): @@ -124,7 +124,7 @@ def test_ident_map(): type='TYPE_MESSAGE', ) - assert str(field.ident) == "Mapping[str, str]" + assert str(field.ident) == "MutableMapping[str, str]" def test_required(): @@ -148,7 +148,7 @@ def test_ident_sphinx(): def test_ident_sphinx_repeated(): REP = descriptor_pb2.FieldDescriptorProto.Label.Value('LABEL_REPEATED') field = make_field(type='TYPE_BOOL', label=REP) - assert field.ident.sphinx == 'Sequence[bool]' + assert field.ident.sphinx == 'MutableSequence[bool]' def test_ident_sphinx_map(): @@ -167,7 +167,7 @@ def test_ident_sphinx_map(): label=3, type='TYPE_MESSAGE', ) - assert field.ident.sphinx == 'Mapping[str, str]' + assert field.ident.sphinx == 'MutableMapping[str, str]' def test_resource_reference():