@@ -113,15 +113,15 @@ class EventarcClient(metaclass=EventarcClientMeta):
113113 """
114114
115115 @staticmethod
116- def _get_default_mtls_endpoint (api_endpoint ):
116+ def _get_default_mtls_endpoint (api_endpoint ) -> Optional [ str ] :
117117 """Converts api endpoint to mTLS endpoint.
118118
119119 Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
120120 "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
121121 Args:
122122 api_endpoint (Optional[str]): the api endpoint to convert.
123123 Returns:
124- str: converted mTLS api endpoint.
124+ Optional[ str] : converted mTLS api endpoint.
125125 """
126126 if not api_endpoint :
127127 return api_endpoint
@@ -131,6 +131,10 @@ def _get_default_mtls_endpoint(api_endpoint):
131131 )
132132
133133 m = mtls_endpoint_re .match (api_endpoint )
134+ if m is None :
135+ # could not parse api_endpoint; return as-is
136+ return api_endpoint
137+
134138 name , mtls , sandbox , googledomain = m .groups ()
135139 if mtls or not googledomain :
136140 return api_endpoint
@@ -491,7 +495,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag):
491495 return client_cert_source
492496
493497 @staticmethod
494- def _get_api_endpoint (api_override , client_cert_source , universe_domain , use_mtls_endpoint ):
498+ def _get_api_endpoint (api_override , client_cert_source , universe_domain , use_mtls_endpoint ) -> str :
495499 """Return the API endpoint used by the client.
496500
497501 Args:
@@ -577,7 +581,7 @@ def _add_cred_info_for_auth_errors(
577581 error ._details .append (json .dumps (cred_info ))
578582
579583 @property
580- def api_endpoint (self ):
584+ def api_endpoint (self ) -> str :
581585 """Return the API endpoint used by the client instance.
582586
583587 Returns:
@@ -2997,7 +3001,7 @@ def __exit__(self, type, value, traceback):
29973001
29983002 def list_operations (
29993003 self ,
3000- request : Optional [operations_pb2 .ListOperationsRequest ] = None ,
3004+ request : Optional [Union [ operations_pb2 .ListOperationsRequest , dict ] ] = None ,
30013005 * ,
30023006 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
30033007 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3023,6 +3027,8 @@ def list_operations(
30233027 # Create or coerce a protobuf request object.
30243028 # The request isn't a proto-plus wrapped type,
30253029 # so it must be constructed via keyword expansion.
3030+ if request is None :
3031+ request = {}
30263032 if isinstance (request , dict ):
30273033 request = operations_pb2 .ListOperationsRequest (** request )
30283034
@@ -3053,7 +3059,7 @@ def list_operations(
30533059
30543060 def get_operation (
30553061 self ,
3056- request : Optional [operations_pb2 .GetOperationRequest ] = None ,
3062+ request : Optional [Union [ operations_pb2 .GetOperationRequest , dict ] ] = None ,
30573063 * ,
30583064 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
30593065 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3079,6 +3085,8 @@ def get_operation(
30793085 # Create or coerce a protobuf request object.
30803086 # The request isn't a proto-plus wrapped type,
30813087 # so it must be constructed via keyword expansion.
3088+ if request is None :
3089+ request = {}
30823090 if isinstance (request , dict ):
30833091 request = operations_pb2 .GetOperationRequest (** request )
30843092
@@ -3109,7 +3117,7 @@ def get_operation(
31093117
31103118 def delete_operation (
31113119 self ,
3112- request : Optional [operations_pb2 .DeleteOperationRequest ] = None ,
3120+ request : Optional [Union [ operations_pb2 .DeleteOperationRequest , dict ] ] = None ,
31133121 * ,
31143122 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
31153123 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3139,6 +3147,8 @@ def delete_operation(
31393147 # Create or coerce a protobuf request object.
31403148 # The request isn't a proto-plus wrapped type,
31413149 # so it must be constructed via keyword expansion.
3150+ if request is None :
3151+ request = {}
31423152 if isinstance (request , dict ):
31433153 request = operations_pb2 .DeleteOperationRequest (** request )
31443154
@@ -3161,7 +3171,7 @@ def delete_operation(
31613171
31623172 def cancel_operation (
31633173 self ,
3164- request : Optional [operations_pb2 .CancelOperationRequest ] = None ,
3174+ request : Optional [Union [ operations_pb2 .CancelOperationRequest , dict ] ] = None ,
31653175 * ,
31663176 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
31673177 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3190,6 +3200,8 @@ def cancel_operation(
31903200 # Create or coerce a protobuf request object.
31913201 # The request isn't a proto-plus wrapped type,
31923202 # so it must be constructed via keyword expansion.
3203+ if request is None :
3204+ request = {}
31933205 if isinstance (request , dict ):
31943206 request = operations_pb2 .CancelOperationRequest (** request )
31953207
@@ -3212,7 +3224,7 @@ def cancel_operation(
32123224
32133225 def set_iam_policy (
32143226 self ,
3215- request : Optional [iam_policy_pb2 .SetIamPolicyRequest ] = None ,
3227+ request : Optional [Union [ iam_policy_pb2 .SetIamPolicyRequest , dict ] ] = None ,
32163228 * ,
32173229 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
32183230 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3304,6 +3316,8 @@ def set_iam_policy(
33043316
33053317 # The request isn't a proto-plus wrapped type,
33063318 # so it must be constructed via keyword expansion.
3319+ if request is None :
3320+ request = {}
33073321 if isinstance (request , dict ):
33083322 request = iam_policy_pb2 .SetIamPolicyRequest (** request )
33093323
@@ -3334,7 +3348,7 @@ def set_iam_policy(
33343348
33353349 def get_iam_policy (
33363350 self ,
3337- request : Optional [iam_policy_pb2 .GetIamPolicyRequest ] = None ,
3351+ request : Optional [Union [ iam_policy_pb2 .GetIamPolicyRequest , dict ] ] = None ,
33383352 * ,
33393353 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
33403354 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3427,6 +3441,8 @@ def get_iam_policy(
34273441
34283442 # The request isn't a proto-plus wrapped type,
34293443 # so it must be constructed via keyword expansion.
3444+ if request is None :
3445+ request = {}
34303446 if isinstance (request , dict ):
34313447 request = iam_policy_pb2 .GetIamPolicyRequest (** request )
34323448
@@ -3457,7 +3473,7 @@ def get_iam_policy(
34573473
34583474 def test_iam_permissions (
34593475 self ,
3460- request : Optional [iam_policy_pb2 .TestIamPermissionsRequest ] = None ,
3476+ request : Optional [Union [ iam_policy_pb2 .TestIamPermissionsRequest , dict ] ] = None ,
34613477 * ,
34623478 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
34633479 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3488,6 +3504,8 @@ def test_iam_permissions(
34883504
34893505 # The request isn't a proto-plus wrapped type,
34903506 # so it must be constructed via keyword expansion.
3507+ if request is None :
3508+ request = {}
34913509 if isinstance (request , dict ):
34923510 request = iam_policy_pb2 .TestIamPermissionsRequest (** request )
34933511
@@ -3518,7 +3536,7 @@ def test_iam_permissions(
35183536
35193537 def get_location (
35203538 self ,
3521- request : Optional [locations_pb2 .GetLocationRequest ] = None ,
3539+ request : Optional [Union [ locations_pb2 .GetLocationRequest , dict ] ] = None ,
35223540 * ,
35233541 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
35243542 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3544,6 +3562,8 @@ def get_location(
35443562 # Create or coerce a protobuf request object.
35453563 # The request isn't a proto-plus wrapped type,
35463564 # so it must be constructed via keyword expansion.
3565+ if request is None :
3566+ request = {}
35473567 if isinstance (request , dict ):
35483568 request = locations_pb2 .GetLocationRequest (** request )
35493569
@@ -3574,7 +3594,7 @@ def get_location(
35743594
35753595 def list_locations (
35763596 self ,
3577- request : Optional [locations_pb2 .ListLocationsRequest ] = None ,
3597+ request : Optional [Union [ locations_pb2 .ListLocationsRequest , dict ] ] = None ,
35783598 * ,
35793599 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
35803600 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
@@ -3600,6 +3620,8 @@ def list_locations(
36003620 # Create or coerce a protobuf request object.
36013621 # The request isn't a proto-plus wrapped type,
36023622 # so it must be constructed via keyword expansion.
3623+ if request is None :
3624+ request = {}
36033625 if isinstance (request , dict ):
36043626 request = locations_pb2 .ListLocationsRequest (** request )
36053627
0 commit comments