13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
#
16
+ import inspect
16
17
import warnings
17
18
from typing import Awaitable , Callable , Dict , Optional , Sequence , Tuple , Union
18
19
@@ -941,17 +942,17 @@ def analyze_org_policy_governed_assets(self) -> Callable[
941
942
def _prep_wrapped_messages (self , client_info ):
942
943
""" Precompute the wrapped methods, overriding the base class method to use async wrappers."""
943
944
self ._wrapped_methods = {
944
- self .export_assets : gapic_v1 . method_async . wrap_method (
945
+ self .export_assets : self . _wrap_method_with_kind (
945
946
self .export_assets ,
946
947
default_timeout = 60.0 ,
947
948
client_info = client_info ,
948
949
),
949
- self .list_assets : gapic_v1 . method_async . wrap_method (
950
+ self .list_assets : self . _wrap_method_with_kind (
950
951
self .list_assets ,
951
952
default_timeout = None ,
952
953
client_info = client_info ,
953
954
),
954
- self .batch_get_assets_history : gapic_v1 . method_async . wrap_method (
955
+ self .batch_get_assets_history : self . _wrap_method_with_kind (
955
956
self .batch_get_assets_history ,
956
957
default_retry = retries .AsyncRetry (
957
958
initial = 0.1 ,
@@ -966,12 +967,12 @@ def _prep_wrapped_messages(self, client_info):
966
967
default_timeout = 60.0 ,
967
968
client_info = client_info ,
968
969
),
969
- self .create_feed : gapic_v1 . method_async . wrap_method (
970
+ self .create_feed : self . _wrap_method_with_kind (
970
971
self .create_feed ,
971
972
default_timeout = 60.0 ,
972
973
client_info = client_info ,
973
974
),
974
- self .get_feed : gapic_v1 . method_async . wrap_method (
975
+ self .get_feed : self . _wrap_method_with_kind (
975
976
self .get_feed ,
976
977
default_retry = retries .AsyncRetry (
977
978
initial = 0.1 ,
@@ -986,7 +987,7 @@ def _prep_wrapped_messages(self, client_info):
986
987
default_timeout = 60.0 ,
987
988
client_info = client_info ,
988
989
),
989
- self .list_feeds : gapic_v1 . method_async . wrap_method (
990
+ self .list_feeds : self . _wrap_method_with_kind (
990
991
self .list_feeds ,
991
992
default_retry = retries .AsyncRetry (
992
993
initial = 0.1 ,
@@ -1001,12 +1002,12 @@ def _prep_wrapped_messages(self, client_info):
1001
1002
default_timeout = 60.0 ,
1002
1003
client_info = client_info ,
1003
1004
),
1004
- self .update_feed : gapic_v1 . method_async . wrap_method (
1005
+ self .update_feed : self . _wrap_method_with_kind (
1005
1006
self .update_feed ,
1006
1007
default_timeout = 60.0 ,
1007
1008
client_info = client_info ,
1008
1009
),
1009
- self .delete_feed : gapic_v1 . method_async . wrap_method (
1010
+ self .delete_feed : self . _wrap_method_with_kind (
1010
1011
self .delete_feed ,
1011
1012
default_retry = retries .AsyncRetry (
1012
1013
initial = 0.1 ,
@@ -1021,7 +1022,7 @@ def _prep_wrapped_messages(self, client_info):
1021
1022
default_timeout = 60.0 ,
1022
1023
client_info = client_info ,
1023
1024
),
1024
- self .search_all_resources : gapic_v1 . method_async . wrap_method (
1025
+ self .search_all_resources : self . _wrap_method_with_kind (
1025
1026
self .search_all_resources ,
1026
1027
default_retry = retries .AsyncRetry (
1027
1028
initial = 0.1 ,
@@ -1036,7 +1037,7 @@ def _prep_wrapped_messages(self, client_info):
1036
1037
default_timeout = 15.0 ,
1037
1038
client_info = client_info ,
1038
1039
),
1039
- self .search_all_iam_policies : gapic_v1 . method_async . wrap_method (
1040
+ self .search_all_iam_policies : self . _wrap_method_with_kind (
1040
1041
self .search_all_iam_policies ,
1041
1042
default_retry = retries .AsyncRetry (
1042
1043
initial = 0.1 ,
@@ -1051,7 +1052,7 @@ def _prep_wrapped_messages(self, client_info):
1051
1052
default_timeout = 15.0 ,
1052
1053
client_info = client_info ,
1053
1054
),
1054
- self .analyze_iam_policy : gapic_v1 . method_async . wrap_method (
1055
+ self .analyze_iam_policy : self . _wrap_method_with_kind (
1055
1056
self .analyze_iam_policy ,
1056
1057
default_retry = retries .AsyncRetry (
1057
1058
initial = 0.1 ,
@@ -1065,71 +1066,80 @@ def _prep_wrapped_messages(self, client_info):
1065
1066
default_timeout = 300.0 ,
1066
1067
client_info = client_info ,
1067
1068
),
1068
- self .analyze_iam_policy_longrunning : gapic_v1 . method_async . wrap_method (
1069
+ self .analyze_iam_policy_longrunning : self . _wrap_method_with_kind (
1069
1070
self .analyze_iam_policy_longrunning ,
1070
1071
default_timeout = 60.0 ,
1071
1072
client_info = client_info ,
1072
1073
),
1073
- self .analyze_move : gapic_v1 . method_async . wrap_method (
1074
+ self .analyze_move : self . _wrap_method_with_kind (
1074
1075
self .analyze_move ,
1075
1076
default_timeout = None ,
1076
1077
client_info = client_info ,
1077
1078
),
1078
- self .query_assets : gapic_v1 . method_async . wrap_method (
1079
+ self .query_assets : self . _wrap_method_with_kind (
1079
1080
self .query_assets ,
1080
1081
default_timeout = None ,
1081
1082
client_info = client_info ,
1082
1083
),
1083
- self .create_saved_query : gapic_v1 . method_async . wrap_method (
1084
+ self .create_saved_query : self . _wrap_method_with_kind (
1084
1085
self .create_saved_query ,
1085
1086
default_timeout = None ,
1086
1087
client_info = client_info ,
1087
1088
),
1088
- self .get_saved_query : gapic_v1 . method_async . wrap_method (
1089
+ self .get_saved_query : self . _wrap_method_with_kind (
1089
1090
self .get_saved_query ,
1090
1091
default_timeout = None ,
1091
1092
client_info = client_info ,
1092
1093
),
1093
- self .list_saved_queries : gapic_v1 . method_async . wrap_method (
1094
+ self .list_saved_queries : self . _wrap_method_with_kind (
1094
1095
self .list_saved_queries ,
1095
1096
default_timeout = None ,
1096
1097
client_info = client_info ,
1097
1098
),
1098
- self .update_saved_query : gapic_v1 . method_async . wrap_method (
1099
+ self .update_saved_query : self . _wrap_method_with_kind (
1099
1100
self .update_saved_query ,
1100
1101
default_timeout = None ,
1101
1102
client_info = client_info ,
1102
1103
),
1103
- self .delete_saved_query : gapic_v1 . method_async . wrap_method (
1104
+ self .delete_saved_query : self . _wrap_method_with_kind (
1104
1105
self .delete_saved_query ,
1105
1106
default_timeout = None ,
1106
1107
client_info = client_info ,
1107
1108
),
1108
- self .batch_get_effective_iam_policies : gapic_v1 . method_async . wrap_method (
1109
+ self .batch_get_effective_iam_policies : self . _wrap_method_with_kind (
1109
1110
self .batch_get_effective_iam_policies ,
1110
1111
default_timeout = None ,
1111
1112
client_info = client_info ,
1112
1113
),
1113
- self .analyze_org_policies : gapic_v1 . method_async . wrap_method (
1114
+ self .analyze_org_policies : self . _wrap_method_with_kind (
1114
1115
self .analyze_org_policies ,
1115
1116
default_timeout = None ,
1116
1117
client_info = client_info ,
1117
1118
),
1118
- self .analyze_org_policy_governed_containers : gapic_v1 . method_async . wrap_method (
1119
+ self .analyze_org_policy_governed_containers : self . _wrap_method_with_kind (
1119
1120
self .analyze_org_policy_governed_containers ,
1120
1121
default_timeout = None ,
1121
1122
client_info = client_info ,
1122
1123
),
1123
- self .analyze_org_policy_governed_assets : gapic_v1 . method_async . wrap_method (
1124
+ self .analyze_org_policy_governed_assets : self . _wrap_method_with_kind (
1124
1125
self .analyze_org_policy_governed_assets ,
1125
1126
default_timeout = None ,
1126
1127
client_info = client_info ,
1127
1128
),
1128
- }
1129
+ }
1130
+
1131
+ def _wrap_method_with_kind (self , func , * args , ** kwargs ):
1132
+ if "kind" in inspect .signature (gapic_v1 .method_async .wrap_method ).parameters :
1133
+ kwargs ["kind" ] = self .kind
1134
+ return gapic_v1 .method_async .wrap_method (func , * args , ** kwargs )
1129
1135
1130
1136
def close (self ):
1131
1137
return self .grpc_channel .close ()
1132
1138
1139
+ @property
1140
+ def kind (self ) -> str :
1141
+ return "grpc"
1142
+
1133
1143
@property
1134
1144
def get_operation (
1135
1145
self ,
0 commit comments