pyodps-catalog 0.1.1__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyodps_catalog/client.py CHANGED
@@ -7,6 +7,7 @@ from maxcompute_tea_openapi import models as open_api_models
7
7
  from pyodps_catalog import models as catalog_api_models
8
8
  from alibabacloud_tea_util import models as util_models
9
9
  from alibabacloud_tea_util.client import Client as UtilClient
10
+ from maxcompute_tea_util.client import Client as McUtilClient
10
11
 
11
12
 
12
13
  class Client(OpenApiClient):
@@ -23,7 +24,7 @@ class Client(OpenApiClient):
23
24
  runtime = util_models.RuntimeOptions()
24
25
  return TeaCore.from_map(
25
26
  catalog_api_models.Table(),
26
- self.request_with_model(table, 'PUT', self.get_table_path(table), runtime)
27
+ self.request_with_model(table, 'PUT', self.get_table_path(table), None, runtime)
27
28
  )
28
29
 
29
30
  async def update_table_async(
@@ -33,7 +34,7 @@ class Client(OpenApiClient):
33
34
  runtime = util_models.RuntimeOptions()
34
35
  return TeaCore.from_map(
35
36
  catalog_api_models.Table(),
36
- await self.request_with_model_async(table, 'PUT', self.get_table_path(table), runtime)
37
+ await self.request_with_model_async(table, 'PUT', self.get_table_path(table), None, runtime)
37
38
  )
38
39
 
39
40
  def delete_table(
@@ -43,7 +44,7 @@ class Client(OpenApiClient):
43
44
  runtime = util_models.RuntimeOptions()
44
45
  return TeaCore.from_map(
45
46
  catalog_api_models.HttpResponse(),
46
- self.request_without_model(table, 'DELETE', self.get_table_path(table), runtime)
47
+ self.request_without_model(table, 'DELETE', self.get_table_path(table), None, runtime)
47
48
  )
48
49
 
49
50
  async def delete_table_async(
@@ -53,7 +54,7 @@ class Client(OpenApiClient):
53
54
  runtime = util_models.RuntimeOptions()
54
55
  return TeaCore.from_map(
55
56
  catalog_api_models.HttpResponse(),
56
- await self.request_without_model_async(table, 'DELETE', self.get_table_path(table), runtime)
57
+ await self.request_without_model_async(table, 'DELETE', self.get_table_path(table), None, runtime)
57
58
  )
58
59
 
59
60
  def create_table(
@@ -63,7 +64,7 @@ class Client(OpenApiClient):
63
64
  runtime = util_models.RuntimeOptions()
64
65
  return TeaCore.from_map(
65
66
  catalog_api_models.Table(),
66
- self.request_with_model(table, 'POST', self.get_tables_path(table), runtime)
67
+ self.request_with_model(table, 'POST', self.get_tables_path(table), None, runtime)
67
68
  )
68
69
 
69
70
  async def create_table_async(
@@ -73,7 +74,7 @@ class Client(OpenApiClient):
73
74
  runtime = util_models.RuntimeOptions()
74
75
  return TeaCore.from_map(
75
76
  catalog_api_models.Table(),
76
- await self.request_with_model_async(table, 'POST', self.get_tables_path(table), runtime)
77
+ await self.request_with_model_async(table, 'POST', self.get_tables_path(table), None, runtime)
77
78
  )
78
79
 
79
80
  def get_table(
@@ -83,7 +84,7 @@ class Client(OpenApiClient):
83
84
  runtime = util_models.RuntimeOptions()
84
85
  return TeaCore.from_map(
85
86
  catalog_api_models.Table(),
86
- self.request_with_model(table, 'GET', self.get_table_path(table), runtime)
87
+ self.request_with_model(table, 'GET', self.get_table_path(table), None, runtime)
87
88
  )
88
89
 
89
90
  async def get_table_async(
@@ -93,7 +94,99 @@ class Client(OpenApiClient):
93
94
  runtime = util_models.RuntimeOptions()
94
95
  return TeaCore.from_map(
95
96
  catalog_api_models.Table(),
96
- await self.request_with_model_async(table, 'GET', self.get_table_path(table), runtime)
97
+ await self.request_with_model_async(table, 'GET', self.get_table_path(table), None, runtime)
98
+ )
99
+
100
+ def list_tables(
101
+ self,
102
+ project_id: str,
103
+ schema_name: str,
104
+ page_size: int,
105
+ page_token: str,
106
+ ) -> catalog_api_models.ListTablesResponse:
107
+ runtime = util_models.RuntimeOptions()
108
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/tables'
109
+ query = {}
110
+ if not UtilClient.is_unset(page_size):
111
+ query['pageSize'] = McUtilClient.to_string(page_size)
112
+ if not UtilClient.is_unset(page_token):
113
+ query['pageToken'] = page_token
114
+ return TeaCore.from_map(
115
+ catalog_api_models.ListTablesResponse(),
116
+ self.request_with_model(catalog_api_models.ListTablesResponse(), 'GET', path, query, runtime)
117
+ )
118
+
119
+ async def list_tables_async(
120
+ self,
121
+ project_id: str,
122
+ schema_name: str,
123
+ page_size: int,
124
+ page_token: str,
125
+ ) -> catalog_api_models.ListTablesResponse:
126
+ runtime = util_models.RuntimeOptions()
127
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/tables'
128
+ query = {}
129
+ if not UtilClient.is_unset(page_size):
130
+ query['pageSize'] = McUtilClient.to_string(page_size)
131
+ if not UtilClient.is_unset(page_token):
132
+ query['pageToken'] = page_token
133
+ return TeaCore.from_map(
134
+ catalog_api_models.ListTablesResponse(),
135
+ await self.request_with_model_async(catalog_api_models.ListTablesResponse(), 'GET', path, query, runtime)
136
+ )
137
+
138
+ def set_table_policy(
139
+ self,
140
+ table: catalog_api_models.Table,
141
+ policy: catalog_api_models.Policy,
142
+ ) -> catalog_api_models.Policy:
143
+ runtime = util_models.RuntimeOptions()
144
+ path = self.get_table_path(table)
145
+ query = {}
146
+ query['method'] = 'getPolicy'
147
+ return TeaCore.from_map(
148
+ catalog_api_models.Policy(),
149
+ self.request_with_model(policy, 'POST', path, query, runtime)
150
+ )
151
+
152
+ async def set_table_policy_async(
153
+ self,
154
+ table: catalog_api_models.Table,
155
+ policy: catalog_api_models.Policy,
156
+ ) -> catalog_api_models.Policy:
157
+ runtime = util_models.RuntimeOptions()
158
+ path = self.get_table_path(table)
159
+ query = {}
160
+ query['method'] = 'getPolicy'
161
+ return TeaCore.from_map(
162
+ catalog_api_models.Policy(),
163
+ await self.request_with_model_async(policy, 'POST', path, query, runtime)
164
+ )
165
+
166
+ def get_table_policy(
167
+ self,
168
+ table: catalog_api_models.Table,
169
+ ) -> catalog_api_models.Policy:
170
+ runtime = util_models.RuntimeOptions()
171
+ path = self.get_table_path(table)
172
+ query = {}
173
+ query['method'] = 'getPolicy'
174
+ return TeaCore.from_map(
175
+ catalog_api_models.Policy(),
176
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
177
+ )
178
+
179
+ async def get_table_policy_async(
180
+ self,
181
+ table: catalog_api_models.Table,
182
+ ) -> catalog_api_models.Policy:
183
+ runtime = util_models.RuntimeOptions()
184
+ path = self.get_table_path(table)
185
+ query = {}
186
+ query['method'] = 'getPolicy'
187
+ return TeaCore.from_map(
188
+ catalog_api_models.Policy(),
189
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
97
190
  )
98
191
 
99
192
  def get_table_path(
@@ -113,3 +206,2146 @@ class Client(OpenApiClient):
113
206
  return f'/api/catalog/v1alpha/projects/{table.project_id}/schemas/default/tables'
114
207
  else:
115
208
  return f'/api/catalog/v1alpha/projects/{table.project_id}/schemas/{table.schema_name}/tables'
209
+
210
+ def create_connection(
211
+ self,
212
+ namespace: str,
213
+ connection: catalog_api_models.Connection,
214
+ ) -> catalog_api_models.Connection:
215
+ runtime = util_models.RuntimeOptions()
216
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/connections'
217
+ return TeaCore.from_map(
218
+ catalog_api_models.Connection(),
219
+ self.request_with_model(connection, 'POST', path, None, runtime)
220
+ )
221
+
222
+ async def create_connection_async(
223
+ self,
224
+ namespace: str,
225
+ connection: catalog_api_models.Connection,
226
+ ) -> catalog_api_models.Connection:
227
+ runtime = util_models.RuntimeOptions()
228
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/connections'
229
+ return TeaCore.from_map(
230
+ catalog_api_models.Connection(),
231
+ await self.request_with_model_async(connection, 'POST', path, None, runtime)
232
+ )
233
+
234
+ def list_connections(
235
+ self,
236
+ namespace: str,
237
+ page_size: int,
238
+ page_token: str,
239
+ ) -> catalog_api_models.ListConnectionsResponse:
240
+ runtime = util_models.RuntimeOptions()
241
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/connections'
242
+ query = {}
243
+ if not UtilClient.is_unset(page_size):
244
+ query['pageSize'] = McUtilClient.to_string(page_size)
245
+ if not UtilClient.is_unset(page_token):
246
+ query['pageToken'] = page_token
247
+ return TeaCore.from_map(
248
+ catalog_api_models.ListConnectionsResponse(),
249
+ self.request_with_model(catalog_api_models.ListConnectionsResponse(), 'GET', path, query, runtime)
250
+ )
251
+
252
+ async def list_connections_async(
253
+ self,
254
+ namespace: str,
255
+ page_size: int,
256
+ page_token: str,
257
+ ) -> catalog_api_models.ListConnectionsResponse:
258
+ runtime = util_models.RuntimeOptions()
259
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/connections'
260
+ query = {}
261
+ if not UtilClient.is_unset(page_size):
262
+ query['pageSize'] = McUtilClient.to_string(page_size)
263
+ if not UtilClient.is_unset(page_token):
264
+ query['pageToken'] = page_token
265
+ return TeaCore.from_map(
266
+ catalog_api_models.ListConnectionsResponse(),
267
+ await self.request_with_model_async(catalog_api_models.ListConnectionsResponse(), 'GET', path, query, runtime)
268
+ )
269
+
270
+ def get_connection(
271
+ self,
272
+ namespace: str,
273
+ connection_name: str,
274
+ ) -> catalog_api_models.Connection:
275
+ runtime = util_models.RuntimeOptions()
276
+ path = self.get_connection_path(namespace, connection_name)
277
+ return TeaCore.from_map(
278
+ catalog_api_models.Connection(),
279
+ self.request_with_model(catalog_api_models.Connection(), 'GET', path, None, runtime)
280
+ )
281
+
282
+ async def get_connection_async(
283
+ self,
284
+ namespace: str,
285
+ connection_name: str,
286
+ ) -> catalog_api_models.Connection:
287
+ runtime = util_models.RuntimeOptions()
288
+ path = self.get_connection_path(namespace, connection_name)
289
+ return TeaCore.from_map(
290
+ catalog_api_models.Connection(),
291
+ await self.request_with_model_async(catalog_api_models.Connection(), 'GET', path, None, runtime)
292
+ )
293
+
294
+ def update_connection(
295
+ self,
296
+ namespace: str,
297
+ connection_name: str,
298
+ connection: catalog_api_models.Connection,
299
+ update_mask: str,
300
+ ) -> catalog_api_models.Connection:
301
+ runtime = util_models.RuntimeOptions()
302
+ path = self.get_connection_path(namespace, connection_name)
303
+ query = {}
304
+ query['updateMask'] = update_mask
305
+ return TeaCore.from_map(
306
+ catalog_api_models.Connection(),
307
+ self.request_with_model(connection, 'PATCH', path, query, runtime)
308
+ )
309
+
310
+ async def update_connection_async(
311
+ self,
312
+ namespace: str,
313
+ connection_name: str,
314
+ connection: catalog_api_models.Connection,
315
+ update_mask: str,
316
+ ) -> catalog_api_models.Connection:
317
+ runtime = util_models.RuntimeOptions()
318
+ path = self.get_connection_path(namespace, connection_name)
319
+ query = {}
320
+ query['updateMask'] = update_mask
321
+ return TeaCore.from_map(
322
+ catalog_api_models.Connection(),
323
+ await self.request_with_model_async(connection, 'PATCH', path, query, runtime)
324
+ )
325
+
326
+ def delete_connection(
327
+ self,
328
+ namespace: str,
329
+ connection_name: str,
330
+ ) -> catalog_api_models.HttpResponse:
331
+ runtime = util_models.RuntimeOptions()
332
+ path = self.get_connection_path(namespace, connection_name)
333
+ return TeaCore.from_map(
334
+ catalog_api_models.HttpResponse(),
335
+ self.request_without_model(catalog_api_models.Connection(), 'DELETE', path, None, runtime)
336
+ )
337
+
338
+ async def delete_connection_async(
339
+ self,
340
+ namespace: str,
341
+ connection_name: str,
342
+ ) -> catalog_api_models.HttpResponse:
343
+ runtime = util_models.RuntimeOptions()
344
+ path = self.get_connection_path(namespace, connection_name)
345
+ return TeaCore.from_map(
346
+ catalog_api_models.HttpResponse(),
347
+ await self.request_without_model_async(catalog_api_models.Connection(), 'DELETE', path, None, runtime)
348
+ )
349
+
350
+ def set_connection_policy(
351
+ self,
352
+ namespace: str,
353
+ connection_name: str,
354
+ request: catalog_api_models.SetPolicyRequest,
355
+ ) -> catalog_api_models.Policy:
356
+ runtime = util_models.RuntimeOptions()
357
+ path = self.get_connection_path(namespace, connection_name)
358
+ query = {}
359
+ query['method'] = 'setPolicy'
360
+ return TeaCore.from_map(
361
+ catalog_api_models.Policy(),
362
+ self.request_with_model(request, 'POST', path, query, runtime)
363
+ )
364
+
365
+ async def set_connection_policy_async(
366
+ self,
367
+ namespace: str,
368
+ connection_name: str,
369
+ request: catalog_api_models.SetPolicyRequest,
370
+ ) -> catalog_api_models.Policy:
371
+ runtime = util_models.RuntimeOptions()
372
+ path = self.get_connection_path(namespace, connection_name)
373
+ query = {}
374
+ query['method'] = 'setPolicy'
375
+ return TeaCore.from_map(
376
+ catalog_api_models.Policy(),
377
+ await self.request_with_model_async(request, 'POST', path, query, runtime)
378
+ )
379
+
380
+ def get_connection_policy(
381
+ self,
382
+ namespace: str,
383
+ connection_name: str,
384
+ ) -> catalog_api_models.Policy:
385
+ runtime = util_models.RuntimeOptions()
386
+ path = self.get_connection_path(namespace, connection_name)
387
+ query = {}
388
+ query['method'] = 'getPolicy'
389
+ return TeaCore.from_map(
390
+ catalog_api_models.Policy(),
391
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
392
+ )
393
+
394
+ async def get_connection_policy_async(
395
+ self,
396
+ namespace: str,
397
+ connection_name: str,
398
+ ) -> catalog_api_models.Policy:
399
+ runtime = util_models.RuntimeOptions()
400
+ path = self.get_connection_path(namespace, connection_name)
401
+ query = {}
402
+ query['method'] = 'getPolicy'
403
+ return TeaCore.from_map(
404
+ catalog_api_models.Policy(),
405
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
406
+ )
407
+
408
+ def get_connection_path(
409
+ self,
410
+ namespace: str,
411
+ connection_name: str,
412
+ ) -> str:
413
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/connections/{connection_name}'
414
+
415
+ def get_role_path(
416
+ self,
417
+ namespace: str,
418
+ role_name: str,
419
+ ) -> str:
420
+ """
421
+ Path generation helper
422
+ """
423
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/roles/{role_name}'
424
+
425
+ def create_role(
426
+ self,
427
+ namespace: str,
428
+ role: catalog_api_models.Role,
429
+ ) -> catalog_api_models.Role:
430
+ """
431
+ Create role
432
+ """
433
+ runtime = util_models.RuntimeOptions()
434
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/roles'
435
+ return TeaCore.from_map(
436
+ catalog_api_models.Role(),
437
+ self.request_with_model(role, 'POST', path, None, runtime)
438
+ )
439
+
440
+ async def create_role_async(
441
+ self,
442
+ namespace: str,
443
+ role: catalog_api_models.Role,
444
+ ) -> catalog_api_models.Role:
445
+ """
446
+ Create role
447
+ """
448
+ runtime = util_models.RuntimeOptions()
449
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/roles'
450
+ return TeaCore.from_map(
451
+ catalog_api_models.Role(),
452
+ await self.request_with_model_async(role, 'POST', path, None, runtime)
453
+ )
454
+
455
+ def delete_role(
456
+ self,
457
+ namespace: str,
458
+ role_name: str,
459
+ ) -> catalog_api_models.HttpResponse:
460
+ """
461
+ Delete role
462
+ """
463
+ runtime = util_models.RuntimeOptions()
464
+ path = self.get_role_path(namespace, role_name)
465
+ return TeaCore.from_map(
466
+ catalog_api_models.HttpResponse(),
467
+ self.request_without_model(catalog_api_models.Role(), 'DELETE', path, None, runtime)
468
+ )
469
+
470
+ async def delete_role_async(
471
+ self,
472
+ namespace: str,
473
+ role_name: str,
474
+ ) -> catalog_api_models.HttpResponse:
475
+ """
476
+ Delete role
477
+ """
478
+ runtime = util_models.RuntimeOptions()
479
+ path = self.get_role_path(namespace, role_name)
480
+ return TeaCore.from_map(
481
+ catalog_api_models.HttpResponse(),
482
+ await self.request_without_model_async(catalog_api_models.Role(), 'DELETE', path, None, runtime)
483
+ )
484
+
485
+ def get_role(
486
+ self,
487
+ namespace: str,
488
+ role_name: str,
489
+ view: str,
490
+ ) -> catalog_api_models.Role:
491
+ """
492
+ Get role
493
+ """
494
+ runtime = util_models.RuntimeOptions()
495
+ path = self.get_role_path(namespace, role_name)
496
+ query = {}
497
+ if not UtilClient.is_unset(view):
498
+ query['view'] = view
499
+ return TeaCore.from_map(
500
+ catalog_api_models.Role(),
501
+ self.request_with_model(catalog_api_models.Role(), 'GET', path, query, runtime)
502
+ )
503
+
504
+ async def get_role_async(
505
+ self,
506
+ namespace: str,
507
+ role_name: str,
508
+ view: str,
509
+ ) -> catalog_api_models.Role:
510
+ """
511
+ Get role
512
+ """
513
+ runtime = util_models.RuntimeOptions()
514
+ path = self.get_role_path(namespace, role_name)
515
+ query = {}
516
+ if not UtilClient.is_unset(view):
517
+ query['view'] = view
518
+ return TeaCore.from_map(
519
+ catalog_api_models.Role(),
520
+ await self.request_with_model_async(catalog_api_models.Role(), 'GET', path, query, runtime)
521
+ )
522
+
523
+ def list_roles(
524
+ self,
525
+ namespace: str,
526
+ page_size: int,
527
+ page_token: str,
528
+ view: str,
529
+ show_deleted: bool,
530
+ ) -> catalog_api_models.ListRolesResponse:
531
+ """
532
+ List roles
533
+ """
534
+ runtime = util_models.RuntimeOptions()
535
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/roles'
536
+ query = {}
537
+ if not UtilClient.is_unset(page_size):
538
+ query['pageSize'] = McUtilClient.to_string(page_size)
539
+ if not UtilClient.is_unset(page_token):
540
+ query['pageToken'] = page_token
541
+ if not UtilClient.is_unset(view):
542
+ query['view'] = view
543
+ if not UtilClient.is_unset(show_deleted):
544
+ query['showDeleted'] = McUtilClient.to_string(show_deleted)
545
+ return TeaCore.from_map(
546
+ catalog_api_models.ListRolesResponse(),
547
+ self.request_with_model(catalog_api_models.ListRolesResponse(), 'GET', path, query, runtime)
548
+ )
549
+
550
+ async def list_roles_async(
551
+ self,
552
+ namespace: str,
553
+ page_size: int,
554
+ page_token: str,
555
+ view: str,
556
+ show_deleted: bool,
557
+ ) -> catalog_api_models.ListRolesResponse:
558
+ """
559
+ List roles
560
+ """
561
+ runtime = util_models.RuntimeOptions()
562
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/roles'
563
+ query = {}
564
+ if not UtilClient.is_unset(page_size):
565
+ query['pageSize'] = McUtilClient.to_string(page_size)
566
+ if not UtilClient.is_unset(page_token):
567
+ query['pageToken'] = page_token
568
+ if not UtilClient.is_unset(view):
569
+ query['view'] = view
570
+ if not UtilClient.is_unset(show_deleted):
571
+ query['showDeleted'] = McUtilClient.to_string(show_deleted)
572
+ return TeaCore.from_map(
573
+ catalog_api_models.ListRolesResponse(),
574
+ await self.request_with_model_async(catalog_api_models.ListRolesResponse(), 'GET', path, query, runtime)
575
+ )
576
+
577
+ def update_role(
578
+ self,
579
+ namespace: str,
580
+ role_name: str,
581
+ role: catalog_api_models.Role,
582
+ update_mask: str,
583
+ ) -> catalog_api_models.Role:
584
+ """
585
+ Update role
586
+ """
587
+ runtime = util_models.RuntimeOptions()
588
+ path = self.get_role_path(namespace, role_name)
589
+ query = {}
590
+ if not UtilClient.is_unset(update_mask):
591
+ query['updateMask'] = update_mask
592
+ return TeaCore.from_map(
593
+ catalog_api_models.Role(),
594
+ self.request_with_model(role, 'PATCH', path, query, runtime)
595
+ )
596
+
597
+ async def update_role_async(
598
+ self,
599
+ namespace: str,
600
+ role_name: str,
601
+ role: catalog_api_models.Role,
602
+ update_mask: str,
603
+ ) -> catalog_api_models.Role:
604
+ """
605
+ Update role
606
+ """
607
+ runtime = util_models.RuntimeOptions()
608
+ path = self.get_role_path(namespace, role_name)
609
+ query = {}
610
+ if not UtilClient.is_unset(update_mask):
611
+ query['updateMask'] = update_mask
612
+ return TeaCore.from_map(
613
+ catalog_api_models.Role(),
614
+ await self.request_with_model_async(role, 'PATCH', path, query, runtime)
615
+ )
616
+
617
+ def set_role_policy(
618
+ self,
619
+ namespace: str,
620
+ role_name: str,
621
+ policy: catalog_api_models.Policy,
622
+ ) -> catalog_api_models.Policy:
623
+ """
624
+ Set role policy
625
+ """
626
+ runtime = util_models.RuntimeOptions()
627
+ path = self.get_role_path(namespace, role_name)
628
+ query = {}
629
+ query['method'] = 'setPolicy'
630
+ return TeaCore.from_map(
631
+ catalog_api_models.Policy(),
632
+ self.request_with_model(policy, 'POST', path, query, runtime)
633
+ )
634
+
635
+ async def set_role_policy_async(
636
+ self,
637
+ namespace: str,
638
+ role_name: str,
639
+ policy: catalog_api_models.Policy,
640
+ ) -> catalog_api_models.Policy:
641
+ """
642
+ Set role policy
643
+ """
644
+ runtime = util_models.RuntimeOptions()
645
+ path = self.get_role_path(namespace, role_name)
646
+ query = {}
647
+ query['method'] = 'setPolicy'
648
+ return TeaCore.from_map(
649
+ catalog_api_models.Policy(),
650
+ await self.request_with_model_async(policy, 'POST', path, query, runtime)
651
+ )
652
+
653
+ def get_role_policy(
654
+ self,
655
+ namespace: str,
656
+ role_name: str,
657
+ ) -> catalog_api_models.Policy:
658
+ """
659
+ Get role policy
660
+ """
661
+ runtime = util_models.RuntimeOptions()
662
+ path = self.get_role_path(namespace, role_name)
663
+ query = {}
664
+ query['method'] = 'getPolicy'
665
+ return TeaCore.from_map(
666
+ catalog_api_models.Policy(),
667
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
668
+ )
669
+
670
+ async def get_role_policy_async(
671
+ self,
672
+ namespace: str,
673
+ role_name: str,
674
+ ) -> catalog_api_models.Policy:
675
+ """
676
+ Get role policy
677
+ """
678
+ runtime = util_models.RuntimeOptions()
679
+ path = self.get_role_path(namespace, role_name)
680
+ query = {}
681
+ query['method'] = 'getPolicy'
682
+ return TeaCore.from_map(
683
+ catalog_api_models.Policy(),
684
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
685
+ )
686
+
687
+ def get_taxonomy_path(
688
+ self,
689
+ namespace: str,
690
+ taxonomy_id: str,
691
+ ) -> str:
692
+ """
693
+ Path generation helpers
694
+ """
695
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/taxonomies/{taxonomy_id}'
696
+
697
+ def get_policy_tag_path(
698
+ self,
699
+ namespace: str,
700
+ taxonomy_id: str,
701
+ policy_tag_id: str,
702
+ ) -> str:
703
+ return f'{self.get_taxonomy_path(namespace, taxonomy_id)}/policyTags/{policy_tag_id}'
704
+
705
+ def create_taxonomy(
706
+ self,
707
+ namespace: str,
708
+ taxonomy: catalog_api_models.Taxonomy,
709
+ ) -> catalog_api_models.Taxonomy:
710
+ """
711
+ Taxonomy operations
712
+ """
713
+ runtime = util_models.RuntimeOptions()
714
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/taxonomies'
715
+ return TeaCore.from_map(
716
+ catalog_api_models.Taxonomy(),
717
+ self.request_with_model(taxonomy, 'POST', path, None, runtime)
718
+ )
719
+
720
+ async def create_taxonomy_async(
721
+ self,
722
+ namespace: str,
723
+ taxonomy: catalog_api_models.Taxonomy,
724
+ ) -> catalog_api_models.Taxonomy:
725
+ """
726
+ Taxonomy operations
727
+ """
728
+ runtime = util_models.RuntimeOptions()
729
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/taxonomies'
730
+ return TeaCore.from_map(
731
+ catalog_api_models.Taxonomy(),
732
+ await self.request_with_model_async(taxonomy, 'POST', path, None, runtime)
733
+ )
734
+
735
+ def delete_taxonomy(
736
+ self,
737
+ namespace: str,
738
+ taxonomy_id: str,
739
+ ) -> catalog_api_models.HttpResponse:
740
+ runtime = util_models.RuntimeOptions()
741
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
742
+ return TeaCore.from_map(
743
+ catalog_api_models.HttpResponse(),
744
+ self.request_without_model(catalog_api_models.Taxonomy(), 'DELETE', path, None, runtime)
745
+ )
746
+
747
+ async def delete_taxonomy_async(
748
+ self,
749
+ namespace: str,
750
+ taxonomy_id: str,
751
+ ) -> catalog_api_models.HttpResponse:
752
+ runtime = util_models.RuntimeOptions()
753
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
754
+ return TeaCore.from_map(
755
+ catalog_api_models.HttpResponse(),
756
+ await self.request_without_model_async(catalog_api_models.Taxonomy(), 'DELETE', path, None, runtime)
757
+ )
758
+
759
+ def get_taxonomy(
760
+ self,
761
+ namespace: str,
762
+ taxonomy_id: str,
763
+ ) -> catalog_api_models.Taxonomy:
764
+ runtime = util_models.RuntimeOptions()
765
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
766
+ return TeaCore.from_map(
767
+ catalog_api_models.Taxonomy(),
768
+ self.request_with_model(catalog_api_models.Taxonomy(), 'GET', path, None, runtime)
769
+ )
770
+
771
+ async def get_taxonomy_async(
772
+ self,
773
+ namespace: str,
774
+ taxonomy_id: str,
775
+ ) -> catalog_api_models.Taxonomy:
776
+ runtime = util_models.RuntimeOptions()
777
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
778
+ return TeaCore.from_map(
779
+ catalog_api_models.Taxonomy(),
780
+ await self.request_with_model_async(catalog_api_models.Taxonomy(), 'GET', path, None, runtime)
781
+ )
782
+
783
+ def list_taxonomies(
784
+ self,
785
+ namespace: str,
786
+ page_size: int,
787
+ page_token: str,
788
+ ) -> catalog_api_models.ListTaxonomiesResponse:
789
+ runtime = util_models.RuntimeOptions()
790
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/taxonomies'
791
+ query = {}
792
+ if not UtilClient.is_unset(page_size):
793
+ query['pageSize'] = McUtilClient.to_string(page_size)
794
+ if not UtilClient.is_unset(page_token):
795
+ query['pageToken'] = page_token
796
+ return TeaCore.from_map(
797
+ catalog_api_models.ListTaxonomiesResponse(),
798
+ self.request_with_model(catalog_api_models.ListTaxonomiesResponse(), 'GET', path, query, runtime)
799
+ )
800
+
801
+ async def list_taxonomies_async(
802
+ self,
803
+ namespace: str,
804
+ page_size: int,
805
+ page_token: str,
806
+ ) -> catalog_api_models.ListTaxonomiesResponse:
807
+ runtime = util_models.RuntimeOptions()
808
+ path = f'/api/catalog/v1alpha/namespaces/{namespace}/taxonomies'
809
+ query = {}
810
+ if not UtilClient.is_unset(page_size):
811
+ query['pageSize'] = McUtilClient.to_string(page_size)
812
+ if not UtilClient.is_unset(page_token):
813
+ query['pageToken'] = page_token
814
+ return TeaCore.from_map(
815
+ catalog_api_models.ListTaxonomiesResponse(),
816
+ await self.request_with_model_async(catalog_api_models.ListTaxonomiesResponse(), 'GET', path, query, runtime)
817
+ )
818
+
819
+ def update_taxonomy(
820
+ self,
821
+ namespace: str,
822
+ taxonomy_id: str,
823
+ taxonomy: catalog_api_models.Taxonomy,
824
+ update_mask: str,
825
+ ) -> catalog_api_models.Taxonomy:
826
+ runtime = util_models.RuntimeOptions()
827
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
828
+ query = {}
829
+ if not UtilClient.is_unset(update_mask):
830
+ query['updateMask'] = update_mask
831
+ return TeaCore.from_map(
832
+ catalog_api_models.Taxonomy(),
833
+ self.request_with_model(taxonomy, 'PATCH', path, query, runtime)
834
+ )
835
+
836
+ async def update_taxonomy_async(
837
+ self,
838
+ namespace: str,
839
+ taxonomy_id: str,
840
+ taxonomy: catalog_api_models.Taxonomy,
841
+ update_mask: str,
842
+ ) -> catalog_api_models.Taxonomy:
843
+ runtime = util_models.RuntimeOptions()
844
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
845
+ query = {}
846
+ if not UtilClient.is_unset(update_mask):
847
+ query['updateMask'] = update_mask
848
+ return TeaCore.from_map(
849
+ catalog_api_models.Taxonomy(),
850
+ await self.request_with_model_async(taxonomy, 'PATCH', path, query, runtime)
851
+ )
852
+
853
+ def set_taxonomy_policy(
854
+ self,
855
+ namespace: str,
856
+ taxonomy_id: str,
857
+ policy: catalog_api_models.Policy,
858
+ ) -> catalog_api_models.Policy:
859
+ runtime = util_models.RuntimeOptions()
860
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
861
+ query = {}
862
+ query['method'] = 'setPolicy'
863
+ return TeaCore.from_map(
864
+ catalog_api_models.Policy(),
865
+ self.request_with_model(policy, 'POST', path, query, runtime)
866
+ )
867
+
868
+ async def set_taxonomy_policy_async(
869
+ self,
870
+ namespace: str,
871
+ taxonomy_id: str,
872
+ policy: catalog_api_models.Policy,
873
+ ) -> catalog_api_models.Policy:
874
+ runtime = util_models.RuntimeOptions()
875
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
876
+ query = {}
877
+ query['method'] = 'setPolicy'
878
+ return TeaCore.from_map(
879
+ catalog_api_models.Policy(),
880
+ await self.request_with_model_async(policy, 'POST', path, query, runtime)
881
+ )
882
+
883
+ def get_taxonomy_policy(
884
+ self,
885
+ namespace: str,
886
+ taxonomy_id: str,
887
+ ) -> catalog_api_models.Policy:
888
+ runtime = util_models.RuntimeOptions()
889
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
890
+ query = {}
891
+ query['method'] = 'getPolicy'
892
+ return TeaCore.from_map(
893
+ catalog_api_models.Policy(),
894
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
895
+ )
896
+
897
+ async def get_taxonomy_policy_async(
898
+ self,
899
+ namespace: str,
900
+ taxonomy_id: str,
901
+ ) -> catalog_api_models.Policy:
902
+ runtime = util_models.RuntimeOptions()
903
+ path = self.get_taxonomy_path(namespace, taxonomy_id)
904
+ query = {}
905
+ query['method'] = 'getPolicy'
906
+ return TeaCore.from_map(
907
+ catalog_api_models.Policy(),
908
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
909
+ )
910
+
911
+ def create_policy_tag(
912
+ self,
913
+ namespace: str,
914
+ taxonomy_id: str,
915
+ policy_tag: catalog_api_models.PolicyTag,
916
+ ) -> catalog_api_models.PolicyTag:
917
+ """
918
+ PolicyTag operations
919
+ """
920
+ runtime = util_models.RuntimeOptions()
921
+ path = f'{self.get_taxonomy_path(namespace, taxonomy_id)}/policyTags'
922
+ return TeaCore.from_map(
923
+ catalog_api_models.PolicyTag(),
924
+ self.request_with_model(policy_tag, 'POST', path, None, runtime)
925
+ )
926
+
927
+ async def create_policy_tag_async(
928
+ self,
929
+ namespace: str,
930
+ taxonomy_id: str,
931
+ policy_tag: catalog_api_models.PolicyTag,
932
+ ) -> catalog_api_models.PolicyTag:
933
+ """
934
+ PolicyTag operations
935
+ """
936
+ runtime = util_models.RuntimeOptions()
937
+ path = f'{self.get_taxonomy_path(namespace, taxonomy_id)}/policyTags'
938
+ return TeaCore.from_map(
939
+ catalog_api_models.PolicyTag(),
940
+ await self.request_with_model_async(policy_tag, 'POST', path, None, runtime)
941
+ )
942
+
943
+ def delete_policy_tag(
944
+ self,
945
+ namespace: str,
946
+ taxonomy_id: str,
947
+ policy_tag_id: str,
948
+ ) -> catalog_api_models.HttpResponse:
949
+ runtime = util_models.RuntimeOptions()
950
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
951
+ return TeaCore.from_map(
952
+ catalog_api_models.HttpResponse(),
953
+ self.request_without_model(catalog_api_models.PolicyTag(), 'DELETE', path, None, runtime)
954
+ )
955
+
956
+ async def delete_policy_tag_async(
957
+ self,
958
+ namespace: str,
959
+ taxonomy_id: str,
960
+ policy_tag_id: str,
961
+ ) -> catalog_api_models.HttpResponse:
962
+ runtime = util_models.RuntimeOptions()
963
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
964
+ return TeaCore.from_map(
965
+ catalog_api_models.HttpResponse(),
966
+ await self.request_without_model_async(catalog_api_models.PolicyTag(), 'DELETE', path, None, runtime)
967
+ )
968
+
969
+ def get_policy_tag(
970
+ self,
971
+ namespace: str,
972
+ taxonomy_id: str,
973
+ policy_tag_id: str,
974
+ ) -> catalog_api_models.PolicyTag:
975
+ runtime = util_models.RuntimeOptions()
976
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
977
+ return TeaCore.from_map(
978
+ catalog_api_models.PolicyTag(),
979
+ self.request_with_model(catalog_api_models.PolicyTag(), 'GET', path, None, runtime)
980
+ )
981
+
982
+ async def get_policy_tag_async(
983
+ self,
984
+ namespace: str,
985
+ taxonomy_id: str,
986
+ policy_tag_id: str,
987
+ ) -> catalog_api_models.PolicyTag:
988
+ runtime = util_models.RuntimeOptions()
989
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
990
+ return TeaCore.from_map(
991
+ catalog_api_models.PolicyTag(),
992
+ await self.request_with_model_async(catalog_api_models.PolicyTag(), 'GET', path, None, runtime)
993
+ )
994
+
995
+ def list_policy_tags(
996
+ self,
997
+ namespace: str,
998
+ taxonomy_id: str,
999
+ page_size: int,
1000
+ page_token: str,
1001
+ ) -> catalog_api_models.ListPolicyTagsResponse:
1002
+ runtime = util_models.RuntimeOptions()
1003
+ path = f'{self.get_taxonomy_path(namespace, taxonomy_id)}/policyTags'
1004
+ query = {}
1005
+ if not UtilClient.is_unset(page_size):
1006
+ query['pageSize'] = McUtilClient.to_string(page_size)
1007
+ if not UtilClient.is_unset(page_token):
1008
+ query['pageToken'] = page_token
1009
+ return TeaCore.from_map(
1010
+ catalog_api_models.ListPolicyTagsResponse(),
1011
+ self.request_with_model(catalog_api_models.ListPolicyTagsResponse(), 'GET', path, query, runtime)
1012
+ )
1013
+
1014
+ async def list_policy_tags_async(
1015
+ self,
1016
+ namespace: str,
1017
+ taxonomy_id: str,
1018
+ page_size: int,
1019
+ page_token: str,
1020
+ ) -> catalog_api_models.ListPolicyTagsResponse:
1021
+ runtime = util_models.RuntimeOptions()
1022
+ path = f'{self.get_taxonomy_path(namespace, taxonomy_id)}/policyTags'
1023
+ query = {}
1024
+ if not UtilClient.is_unset(page_size):
1025
+ query['pageSize'] = McUtilClient.to_string(page_size)
1026
+ if not UtilClient.is_unset(page_token):
1027
+ query['pageToken'] = page_token
1028
+ return TeaCore.from_map(
1029
+ catalog_api_models.ListPolicyTagsResponse(),
1030
+ await self.request_with_model_async(catalog_api_models.ListPolicyTagsResponse(), 'GET', path, query, runtime)
1031
+ )
1032
+
1033
+ def update_policy_tag(
1034
+ self,
1035
+ namespace: str,
1036
+ taxonomy_id: str,
1037
+ policy_tag_id: str,
1038
+ policy_tag: catalog_api_models.PolicyTag,
1039
+ update_mask: str,
1040
+ ) -> catalog_api_models.PolicyTag:
1041
+ runtime = util_models.RuntimeOptions()
1042
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
1043
+ query = {}
1044
+ if not UtilClient.is_unset(update_mask):
1045
+ query['updateMask'] = update_mask
1046
+ return TeaCore.from_map(
1047
+ catalog_api_models.PolicyTag(),
1048
+ self.request_with_model(policy_tag, 'PATCH', path, query, runtime)
1049
+ )
1050
+
1051
+ async def update_policy_tag_async(
1052
+ self,
1053
+ namespace: str,
1054
+ taxonomy_id: str,
1055
+ policy_tag_id: str,
1056
+ policy_tag: catalog_api_models.PolicyTag,
1057
+ update_mask: str,
1058
+ ) -> catalog_api_models.PolicyTag:
1059
+ runtime = util_models.RuntimeOptions()
1060
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
1061
+ query = {}
1062
+ if not UtilClient.is_unset(update_mask):
1063
+ query['updateMask'] = update_mask
1064
+ return TeaCore.from_map(
1065
+ catalog_api_models.PolicyTag(),
1066
+ await self.request_with_model_async(policy_tag, 'PATCH', path, query, runtime)
1067
+ )
1068
+
1069
+ def set_policy_tag_policy(
1070
+ self,
1071
+ namespace: str,
1072
+ taxonomy_id: str,
1073
+ policy_tag_id: str,
1074
+ policy: catalog_api_models.Policy,
1075
+ ) -> catalog_api_models.Policy:
1076
+ runtime = util_models.RuntimeOptions()
1077
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
1078
+ query = {}
1079
+ query['method'] = 'setPolicy'
1080
+ return TeaCore.from_map(
1081
+ catalog_api_models.Policy(),
1082
+ self.request_with_model(policy, 'POST', path, query, runtime)
1083
+ )
1084
+
1085
+ async def set_policy_tag_policy_async(
1086
+ self,
1087
+ namespace: str,
1088
+ taxonomy_id: str,
1089
+ policy_tag_id: str,
1090
+ policy: catalog_api_models.Policy,
1091
+ ) -> catalog_api_models.Policy:
1092
+ runtime = util_models.RuntimeOptions()
1093
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
1094
+ query = {}
1095
+ query['method'] = 'setPolicy'
1096
+ return TeaCore.from_map(
1097
+ catalog_api_models.Policy(),
1098
+ await self.request_with_model_async(policy, 'POST', path, query, runtime)
1099
+ )
1100
+
1101
+ def get_policy_tag_policy(
1102
+ self,
1103
+ namespace: str,
1104
+ taxonomy_id: str,
1105
+ policy_tag_id: str,
1106
+ ) -> catalog_api_models.Policy:
1107
+ runtime = util_models.RuntimeOptions()
1108
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
1109
+ query = {}
1110
+ query['method'] = 'getPolicy'
1111
+ return TeaCore.from_map(
1112
+ catalog_api_models.Policy(),
1113
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
1114
+ )
1115
+
1116
+ async def get_policy_tag_policy_async(
1117
+ self,
1118
+ namespace: str,
1119
+ taxonomy_id: str,
1120
+ policy_tag_id: str,
1121
+ ) -> catalog_api_models.Policy:
1122
+ runtime = util_models.RuntimeOptions()
1123
+ path = self.get_policy_tag_path(namespace, taxonomy_id, policy_tag_id)
1124
+ query = {}
1125
+ query['method'] = 'getPolicy'
1126
+ return TeaCore.from_map(
1127
+ catalog_api_models.Policy(),
1128
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
1129
+ )
1130
+
1131
+ def create_data_policy(
1132
+ self,
1133
+ namespace: str,
1134
+ data_policy: catalog_api_models.DataPolicy,
1135
+ ) -> catalog_api_models.DataPolicy:
1136
+ runtime = util_models.RuntimeOptions()
1137
+ path = self.get_data_policies_path(namespace)
1138
+ return TeaCore.from_map(
1139
+ catalog_api_models.DataPolicy(),
1140
+ self.request_with_model(data_policy, 'POST', path, None, runtime)
1141
+ )
1142
+
1143
+ async def create_data_policy_async(
1144
+ self,
1145
+ namespace: str,
1146
+ data_policy: catalog_api_models.DataPolicy,
1147
+ ) -> catalog_api_models.DataPolicy:
1148
+ runtime = util_models.RuntimeOptions()
1149
+ path = self.get_data_policies_path(namespace)
1150
+ return TeaCore.from_map(
1151
+ catalog_api_models.DataPolicy(),
1152
+ await self.request_with_model_async(data_policy, 'POST', path, None, runtime)
1153
+ )
1154
+
1155
+ def delete_data_policy(
1156
+ self,
1157
+ namespace: str,
1158
+ data_policy_name: str,
1159
+ ) -> catalog_api_models.HttpResponse:
1160
+ runtime = util_models.RuntimeOptions()
1161
+ path = self.get_data_policy_path(namespace, data_policy_name)
1162
+ return TeaCore.from_map(
1163
+ catalog_api_models.HttpResponse(),
1164
+ self.request_without_model(catalog_api_models.DataPolicy(), 'DELETE', path, None, runtime)
1165
+ )
1166
+
1167
+ async def delete_data_policy_async(
1168
+ self,
1169
+ namespace: str,
1170
+ data_policy_name: str,
1171
+ ) -> catalog_api_models.HttpResponse:
1172
+ runtime = util_models.RuntimeOptions()
1173
+ path = self.get_data_policy_path(namespace, data_policy_name)
1174
+ return TeaCore.from_map(
1175
+ catalog_api_models.HttpResponse(),
1176
+ await self.request_without_model_async(catalog_api_models.DataPolicy(), 'DELETE', path, None, runtime)
1177
+ )
1178
+
1179
+ def get_data_policy(
1180
+ self,
1181
+ namespace: str,
1182
+ data_policy_name: str,
1183
+ ) -> catalog_api_models.DataPolicy:
1184
+ runtime = util_models.RuntimeOptions()
1185
+ path = self.get_data_policy_path(namespace, data_policy_name)
1186
+ return TeaCore.from_map(
1187
+ catalog_api_models.DataPolicy(),
1188
+ self.request_with_model(catalog_api_models.DataPolicy(), 'GET', path, None, runtime)
1189
+ )
1190
+
1191
+ async def get_data_policy_async(
1192
+ self,
1193
+ namespace: str,
1194
+ data_policy_name: str,
1195
+ ) -> catalog_api_models.DataPolicy:
1196
+ runtime = util_models.RuntimeOptions()
1197
+ path = self.get_data_policy_path(namespace, data_policy_name)
1198
+ return TeaCore.from_map(
1199
+ catalog_api_models.DataPolicy(),
1200
+ await self.request_with_model_async(catalog_api_models.DataPolicy(), 'GET', path, None, runtime)
1201
+ )
1202
+
1203
+ def list_data_policies(
1204
+ self,
1205
+ namespace: str,
1206
+ page_size: int,
1207
+ page_token: str,
1208
+ ) -> catalog_api_models.ListDataPoliciesResponse:
1209
+ runtime = util_models.RuntimeOptions()
1210
+ path = self.get_data_policies_path(namespace)
1211
+ query = {}
1212
+ if not UtilClient.is_unset(page_size):
1213
+ query['pageSize'] = McUtilClient.to_string(page_size)
1214
+ if not UtilClient.is_unset(page_token):
1215
+ query['pageToken'] = page_token
1216
+ return TeaCore.from_map(
1217
+ catalog_api_models.ListDataPoliciesResponse(),
1218
+ self.request_with_model(catalog_api_models.ListDataPoliciesResponse(), 'GET', path, query, runtime)
1219
+ )
1220
+
1221
+ async def list_data_policies_async(
1222
+ self,
1223
+ namespace: str,
1224
+ page_size: int,
1225
+ page_token: str,
1226
+ ) -> catalog_api_models.ListDataPoliciesResponse:
1227
+ runtime = util_models.RuntimeOptions()
1228
+ path = self.get_data_policies_path(namespace)
1229
+ query = {}
1230
+ if not UtilClient.is_unset(page_size):
1231
+ query['pageSize'] = McUtilClient.to_string(page_size)
1232
+ if not UtilClient.is_unset(page_token):
1233
+ query['pageToken'] = page_token
1234
+ return TeaCore.from_map(
1235
+ catalog_api_models.ListDataPoliciesResponse(),
1236
+ await self.request_with_model_async(catalog_api_models.ListDataPoliciesResponse(), 'GET', path, query, runtime)
1237
+ )
1238
+
1239
+ def set_data_policy_policy(
1240
+ self,
1241
+ namespace: str,
1242
+ data_policy_name: str,
1243
+ request: catalog_api_models.SetPolicyRequest,
1244
+ ) -> catalog_api_models.Policy:
1245
+ runtime = util_models.RuntimeOptions()
1246
+ path = self.get_data_policy_path(namespace, data_policy_name)
1247
+ query = {}
1248
+ query['method'] = 'setPolicy'
1249
+ return TeaCore.from_map(
1250
+ catalog_api_models.Policy(),
1251
+ self.request_with_model(request, 'POST', path, query, runtime)
1252
+ )
1253
+
1254
+ async def set_data_policy_policy_async(
1255
+ self,
1256
+ namespace: str,
1257
+ data_policy_name: str,
1258
+ request: catalog_api_models.SetPolicyRequest,
1259
+ ) -> catalog_api_models.Policy:
1260
+ runtime = util_models.RuntimeOptions()
1261
+ path = self.get_data_policy_path(namespace, data_policy_name)
1262
+ query = {}
1263
+ query['method'] = 'setPolicy'
1264
+ return TeaCore.from_map(
1265
+ catalog_api_models.Policy(),
1266
+ await self.request_with_model_async(request, 'POST', path, query, runtime)
1267
+ )
1268
+
1269
+ def get_data_policy_policy(
1270
+ self,
1271
+ namespace: str,
1272
+ data_policy_name: str,
1273
+ ) -> catalog_api_models.Policy:
1274
+ runtime = util_models.RuntimeOptions()
1275
+ path = self.get_data_policy_path(namespace, data_policy_name)
1276
+ query = {}
1277
+ query['method'] = 'getPolicy'
1278
+ return TeaCore.from_map(
1279
+ catalog_api_models.Policy(),
1280
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
1281
+ )
1282
+
1283
+ async def get_data_policy_policy_async(
1284
+ self,
1285
+ namespace: str,
1286
+ data_policy_name: str,
1287
+ ) -> catalog_api_models.Policy:
1288
+ runtime = util_models.RuntimeOptions()
1289
+ path = self.get_data_policy_path(namespace, data_policy_name)
1290
+ query = {}
1291
+ query['method'] = 'getPolicy'
1292
+ return TeaCore.from_map(
1293
+ catalog_api_models.Policy(),
1294
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
1295
+ )
1296
+
1297
+ def get_data_policy_path(
1298
+ self,
1299
+ namespace: str,
1300
+ data_policy_name: str,
1301
+ ) -> str:
1302
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/dataPolicies/{data_policy_name}'
1303
+
1304
+ def get_data_policies_path(
1305
+ self,
1306
+ namespace: str,
1307
+ ) -> str:
1308
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/dataPolicies'
1309
+
1310
+ def get_project_path(
1311
+ self,
1312
+ project_id: str,
1313
+ ) -> str:
1314
+ """
1315
+ Paths
1316
+ """
1317
+ return f'/api/catalog/v1alpha/projects/{project_id}'
1318
+
1319
+ def get_schema_path(
1320
+ self,
1321
+ project_id: str,
1322
+ schema_name: str,
1323
+ ) -> str:
1324
+ return f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}'
1325
+
1326
+ def list_projects(
1327
+ self,
1328
+ page_size: int,
1329
+ page_token: str,
1330
+ ) -> catalog_api_models.ListProjectsResponse:
1331
+ """
1332
+ Methods
1333
+ """
1334
+ runtime = util_models.RuntimeOptions()
1335
+ query = {}
1336
+ if not UtilClient.is_unset(page_size):
1337
+ query['pageSize'] = McUtilClient.to_string(page_size)
1338
+ if not UtilClient.is_unset(page_token):
1339
+ query['pageToken'] = page_token
1340
+ return TeaCore.from_map(
1341
+ catalog_api_models.ListProjectsResponse(),
1342
+ self.request_with_model(catalog_api_models.ListProjectsResponse(), 'GET', '/api/catalog/v1alpha/projects', query, runtime)
1343
+ )
1344
+
1345
+ async def list_projects_async(
1346
+ self,
1347
+ page_size: int,
1348
+ page_token: str,
1349
+ ) -> catalog_api_models.ListProjectsResponse:
1350
+ """
1351
+ Methods
1352
+ """
1353
+ runtime = util_models.RuntimeOptions()
1354
+ query = {}
1355
+ if not UtilClient.is_unset(page_size):
1356
+ query['pageSize'] = McUtilClient.to_string(page_size)
1357
+ if not UtilClient.is_unset(page_token):
1358
+ query['pageToken'] = page_token
1359
+ return TeaCore.from_map(
1360
+ catalog_api_models.ListProjectsResponse(),
1361
+ await self.request_with_model_async(catalog_api_models.ListProjectsResponse(), 'GET', '/api/catalog/v1alpha/projects', query, runtime)
1362
+ )
1363
+
1364
+ def get_project(
1365
+ self,
1366
+ project_id: str,
1367
+ ) -> catalog_api_models.Project:
1368
+ runtime = util_models.RuntimeOptions()
1369
+ return TeaCore.from_map(
1370
+ catalog_api_models.Project(),
1371
+ self.request_with_model(catalog_api_models.Project(), 'GET', self.get_project_path(project_id), None, runtime)
1372
+ )
1373
+
1374
+ async def get_project_async(
1375
+ self,
1376
+ project_id: str,
1377
+ ) -> catalog_api_models.Project:
1378
+ runtime = util_models.RuntimeOptions()
1379
+ return TeaCore.from_map(
1380
+ catalog_api_models.Project(),
1381
+ await self.request_with_model_async(catalog_api_models.Project(), 'GET', self.get_project_path(project_id), None, runtime)
1382
+ )
1383
+
1384
+ def create_schema(
1385
+ self,
1386
+ project_id: str,
1387
+ schema: catalog_api_models.Schema,
1388
+ ) -> catalog_api_models.Schema:
1389
+ runtime = util_models.RuntimeOptions()
1390
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas'
1391
+ return TeaCore.from_map(
1392
+ catalog_api_models.Schema(),
1393
+ self.request_with_model(schema, 'POST', path, None, runtime)
1394
+ )
1395
+
1396
+ async def create_schema_async(
1397
+ self,
1398
+ project_id: str,
1399
+ schema: catalog_api_models.Schema,
1400
+ ) -> catalog_api_models.Schema:
1401
+ runtime = util_models.RuntimeOptions()
1402
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas'
1403
+ return TeaCore.from_map(
1404
+ catalog_api_models.Schema(),
1405
+ await self.request_with_model_async(schema, 'POST', path, None, runtime)
1406
+ )
1407
+
1408
+ def list_schemas(
1409
+ self,
1410
+ project_id: str,
1411
+ page_size: int,
1412
+ page_token: str,
1413
+ ) -> catalog_api_models.ListSchemasResponse:
1414
+ runtime = util_models.RuntimeOptions()
1415
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas'
1416
+ query = {}
1417
+ if not UtilClient.is_unset(page_size):
1418
+ query['pageSize'] = McUtilClient.to_string(page_size)
1419
+ if not UtilClient.is_unset(page_token):
1420
+ query['pageToken'] = page_token
1421
+ return TeaCore.from_map(
1422
+ catalog_api_models.ListSchemasResponse(),
1423
+ self.request_with_model(catalog_api_models.ListSchemasResponse(), 'GET', path, query, runtime)
1424
+ )
1425
+
1426
+ async def list_schemas_async(
1427
+ self,
1428
+ project_id: str,
1429
+ page_size: int,
1430
+ page_token: str,
1431
+ ) -> catalog_api_models.ListSchemasResponse:
1432
+ runtime = util_models.RuntimeOptions()
1433
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas'
1434
+ query = {}
1435
+ if not UtilClient.is_unset(page_size):
1436
+ query['pageSize'] = McUtilClient.to_string(page_size)
1437
+ if not UtilClient.is_unset(page_token):
1438
+ query['pageToken'] = page_token
1439
+ return TeaCore.from_map(
1440
+ catalog_api_models.ListSchemasResponse(),
1441
+ await self.request_with_model_async(catalog_api_models.ListSchemasResponse(), 'GET', path, query, runtime)
1442
+ )
1443
+
1444
+ def get_schema(
1445
+ self,
1446
+ project_id: str,
1447
+ schema_name: str,
1448
+ ) -> catalog_api_models.Schema:
1449
+ runtime = util_models.RuntimeOptions()
1450
+ return TeaCore.from_map(
1451
+ catalog_api_models.Schema(),
1452
+ self.request_with_model(catalog_api_models.Schema(), 'GET', self.get_schema_path(project_id, schema_name), None, runtime)
1453
+ )
1454
+
1455
+ async def get_schema_async(
1456
+ self,
1457
+ project_id: str,
1458
+ schema_name: str,
1459
+ ) -> catalog_api_models.Schema:
1460
+ runtime = util_models.RuntimeOptions()
1461
+ return TeaCore.from_map(
1462
+ catalog_api_models.Schema(),
1463
+ await self.request_with_model_async(catalog_api_models.Schema(), 'GET', self.get_schema_path(project_id, schema_name), None, runtime)
1464
+ )
1465
+
1466
+ def update_schema(
1467
+ self,
1468
+ project_id: str,
1469
+ schema_name: str,
1470
+ update_mask: str,
1471
+ schema: catalog_api_models.Schema,
1472
+ ) -> catalog_api_models.Schema:
1473
+ runtime = util_models.RuntimeOptions()
1474
+ path = self.get_schema_path(project_id, schema_name)
1475
+ query = {}
1476
+ query['updateMask'] = update_mask
1477
+ return TeaCore.from_map(
1478
+ catalog_api_models.Schema(),
1479
+ self.request_with_model(schema, 'PATCH', path, query, runtime)
1480
+ )
1481
+
1482
+ async def update_schema_async(
1483
+ self,
1484
+ project_id: str,
1485
+ schema_name: str,
1486
+ update_mask: str,
1487
+ schema: catalog_api_models.Schema,
1488
+ ) -> catalog_api_models.Schema:
1489
+ runtime = util_models.RuntimeOptions()
1490
+ path = self.get_schema_path(project_id, schema_name)
1491
+ query = {}
1492
+ query['updateMask'] = update_mask
1493
+ return TeaCore.from_map(
1494
+ catalog_api_models.Schema(),
1495
+ await self.request_with_model_async(schema, 'PATCH', path, query, runtime)
1496
+ )
1497
+
1498
+ def delete_schema(
1499
+ self,
1500
+ project_id: str,
1501
+ schema_name: str,
1502
+ ) -> catalog_api_models.HttpResponse:
1503
+ runtime = util_models.RuntimeOptions()
1504
+ path = self.get_schema_path(project_id, schema_name)
1505
+ return TeaCore.from_map(
1506
+ catalog_api_models.HttpResponse(),
1507
+ self.request_without_model(catalog_api_models.Schema(), 'DELETE', path, None, runtime)
1508
+ )
1509
+
1510
+ async def delete_schema_async(
1511
+ self,
1512
+ project_id: str,
1513
+ schema_name: str,
1514
+ ) -> catalog_api_models.HttpResponse:
1515
+ runtime = util_models.RuntimeOptions()
1516
+ path = self.get_schema_path(project_id, schema_name)
1517
+ return TeaCore.from_map(
1518
+ catalog_api_models.HttpResponse(),
1519
+ await self.request_without_model_async(catalog_api_models.Schema(), 'DELETE', path, None, runtime)
1520
+ )
1521
+
1522
+ def set_schema_policy(
1523
+ self,
1524
+ project_id: str,
1525
+ schema_name: str,
1526
+ policy: catalog_api_models.Policy,
1527
+ ) -> catalog_api_models.Policy:
1528
+ runtime = util_models.RuntimeOptions()
1529
+ path = self.get_schema_path(project_id, schema_name)
1530
+ query = {}
1531
+ query['method'] = 'setPolicy'
1532
+ return TeaCore.from_map(
1533
+ catalog_api_models.Policy(),
1534
+ self.request_with_model(policy, 'POST', path, query, runtime)
1535
+ )
1536
+
1537
+ async def set_schema_policy_async(
1538
+ self,
1539
+ project_id: str,
1540
+ schema_name: str,
1541
+ policy: catalog_api_models.Policy,
1542
+ ) -> catalog_api_models.Policy:
1543
+ runtime = util_models.RuntimeOptions()
1544
+ path = self.get_schema_path(project_id, schema_name)
1545
+ query = {}
1546
+ query['method'] = 'setPolicy'
1547
+ return TeaCore.from_map(
1548
+ catalog_api_models.Policy(),
1549
+ await self.request_with_model_async(policy, 'POST', path, query, runtime)
1550
+ )
1551
+
1552
+ def get_schema_policy(
1553
+ self,
1554
+ project_id: str,
1555
+ schema_name: str,
1556
+ ) -> catalog_api_models.Policy:
1557
+ runtime = util_models.RuntimeOptions()
1558
+ path = self.get_schema_path(project_id, schema_name)
1559
+ query = {}
1560
+ query['method'] = 'getPolicy'
1561
+ return TeaCore.from_map(
1562
+ catalog_api_models.Policy(),
1563
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
1564
+ )
1565
+
1566
+ async def get_schema_policy_async(
1567
+ self,
1568
+ project_id: str,
1569
+ schema_name: str,
1570
+ ) -> catalog_api_models.Policy:
1571
+ runtime = util_models.RuntimeOptions()
1572
+ path = self.get_schema_path(project_id, schema_name)
1573
+ query = {}
1574
+ query['method'] = 'getPolicy'
1575
+ return TeaCore.from_map(
1576
+ catalog_api_models.Policy(),
1577
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
1578
+ )
1579
+
1580
+ def get_table_partitions_path(
1581
+ self,
1582
+ project_id: str,
1583
+ schema_name: str,
1584
+ table_name: str,
1585
+ ) -> str:
1586
+ """
1587
+ Path Functions
1588
+ """
1589
+ return f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/tables/{table_name}/partitions'
1590
+
1591
+ def list_partitions(
1592
+ self,
1593
+ project_id: str,
1594
+ schema_name: str,
1595
+ table_name: str,
1596
+ page_size: int,
1597
+ page_token: str,
1598
+ ) -> catalog_api_models.ListPartitionsResponse:
1599
+ """
1600
+ Methods
1601
+ """
1602
+ runtime = util_models.RuntimeOptions()
1603
+ path = self.get_table_partitions_path(project_id, schema_name, table_name)
1604
+ query = {}
1605
+ if not UtilClient.is_unset(page_size):
1606
+ query['pageSize'] = McUtilClient.to_string(page_size)
1607
+ if not UtilClient.is_unset(page_token):
1608
+ query['pageToken'] = page_token
1609
+ return TeaCore.from_map(
1610
+ catalog_api_models.ListPartitionsResponse(),
1611
+ self.request_with_model(catalog_api_models.ListPartitionsResponse(), 'GET', path, query, runtime)
1612
+ )
1613
+
1614
+ async def list_partitions_async(
1615
+ self,
1616
+ project_id: str,
1617
+ schema_name: str,
1618
+ table_name: str,
1619
+ page_size: int,
1620
+ page_token: str,
1621
+ ) -> catalog_api_models.ListPartitionsResponse:
1622
+ """
1623
+ Methods
1624
+ """
1625
+ runtime = util_models.RuntimeOptions()
1626
+ path = self.get_table_partitions_path(project_id, schema_name, table_name)
1627
+ query = {}
1628
+ if not UtilClient.is_unset(page_size):
1629
+ query['pageSize'] = McUtilClient.to_string(page_size)
1630
+ if not UtilClient.is_unset(page_token):
1631
+ query['pageToken'] = page_token
1632
+ return TeaCore.from_map(
1633
+ catalog_api_models.ListPartitionsResponse(),
1634
+ await self.request_with_model_async(catalog_api_models.ListPartitionsResponse(), 'GET', path, query, runtime)
1635
+ )
1636
+
1637
+ def get_data_scan_path(
1638
+ self,
1639
+ namespace: str,
1640
+ data_scan_name: str,
1641
+ ) -> str:
1642
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/dataScans/{data_scan_name}'
1643
+
1644
+ def get_data_scans_path(
1645
+ self,
1646
+ namespace: str,
1647
+ ) -> str:
1648
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/dataScans'
1649
+
1650
+ def get_trigger_data_scan_path(
1651
+ self,
1652
+ namespace: str,
1653
+ data_scan_name: str,
1654
+ ) -> str:
1655
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/dataScans/{data_scan_name}:trigger'
1656
+
1657
+ def trigger_data_scan(
1658
+ self,
1659
+ namespace: str,
1660
+ data_scan_name: str,
1661
+ ) -> catalog_api_models.HttpResponse:
1662
+ return TeaCore.from_map(
1663
+ catalog_api_models.HttpResponse(),
1664
+ self.request_without_model(catalog_api_models.ScanJob(), 'POST', self.get_trigger_data_scan_path(namespace, data_scan_name), None, util_models.RuntimeOptions())
1665
+ )
1666
+
1667
+ async def trigger_data_scan_async(
1668
+ self,
1669
+ namespace: str,
1670
+ data_scan_name: str,
1671
+ ) -> catalog_api_models.HttpResponse:
1672
+ return TeaCore.from_map(
1673
+ catalog_api_models.HttpResponse(),
1674
+ await self.request_without_model_async(catalog_api_models.ScanJob(), 'POST', self.get_trigger_data_scan_path(namespace, data_scan_name), None, util_models.RuntimeOptions())
1675
+ )
1676
+
1677
+ def update_data_scan(
1678
+ self,
1679
+ namespace: str,
1680
+ data_scan: catalog_api_models.DataScan,
1681
+ update_mask: str,
1682
+ ) -> catalog_api_models.DataScan:
1683
+ runtime = util_models.RuntimeOptions()
1684
+ query = {}
1685
+ query['updateMask'] = update_mask
1686
+ return TeaCore.from_map(
1687
+ catalog_api_models.DataScan(),
1688
+ self.request_with_model(data_scan, 'PATCH', self.get_data_scan_path(namespace, data_scan.scan_name), query, runtime)
1689
+ )
1690
+
1691
+ async def update_data_scan_async(
1692
+ self,
1693
+ namespace: str,
1694
+ data_scan: catalog_api_models.DataScan,
1695
+ update_mask: str,
1696
+ ) -> catalog_api_models.DataScan:
1697
+ runtime = util_models.RuntimeOptions()
1698
+ query = {}
1699
+ query['updateMask'] = update_mask
1700
+ return TeaCore.from_map(
1701
+ catalog_api_models.DataScan(),
1702
+ await self.request_with_model_async(data_scan, 'PATCH', self.get_data_scan_path(namespace, data_scan.scan_name), query, runtime)
1703
+ )
1704
+
1705
+ def delete_data_scan(
1706
+ self,
1707
+ namespace: str,
1708
+ data_scan_name: str,
1709
+ ) -> catalog_api_models.HttpResponse:
1710
+ runtime = util_models.RuntimeOptions()
1711
+ return TeaCore.from_map(
1712
+ catalog_api_models.HttpResponse(),
1713
+ self.request_without_model(catalog_api_models.DataScan(), 'DELETE', self.get_data_scan_path(namespace, data_scan_name), None, runtime)
1714
+ )
1715
+
1716
+ async def delete_data_scan_async(
1717
+ self,
1718
+ namespace: str,
1719
+ data_scan_name: str,
1720
+ ) -> catalog_api_models.HttpResponse:
1721
+ runtime = util_models.RuntimeOptions()
1722
+ return TeaCore.from_map(
1723
+ catalog_api_models.HttpResponse(),
1724
+ await self.request_without_model_async(catalog_api_models.DataScan(), 'DELETE', self.get_data_scan_path(namespace, data_scan_name), None, runtime)
1725
+ )
1726
+
1727
+ def create_data_scan(
1728
+ self,
1729
+ namespace: str,
1730
+ data_scan: catalog_api_models.DataScan,
1731
+ ) -> catalog_api_models.DataScan:
1732
+ runtime = util_models.RuntimeOptions()
1733
+ return TeaCore.from_map(
1734
+ catalog_api_models.DataScan(),
1735
+ self.request_with_model(data_scan, 'POST', self.get_data_scans_path(namespace), None, runtime)
1736
+ )
1737
+
1738
+ async def create_data_scan_async(
1739
+ self,
1740
+ namespace: str,
1741
+ data_scan: catalog_api_models.DataScan,
1742
+ ) -> catalog_api_models.DataScan:
1743
+ runtime = util_models.RuntimeOptions()
1744
+ return TeaCore.from_map(
1745
+ catalog_api_models.DataScan(),
1746
+ await self.request_with_model_async(data_scan, 'POST', self.get_data_scans_path(namespace), None, runtime)
1747
+ )
1748
+
1749
+ def get_data_scan(
1750
+ self,
1751
+ namespace: str,
1752
+ data_scan_name: str,
1753
+ ) -> catalog_api_models.DataScan:
1754
+ runtime = util_models.RuntimeOptions()
1755
+ return TeaCore.from_map(
1756
+ catalog_api_models.DataScan(),
1757
+ self.request_with_model(catalog_api_models.DataScan(), 'GET', self.get_data_scan_path(namespace, data_scan_name), None, runtime)
1758
+ )
1759
+
1760
+ async def get_data_scan_async(
1761
+ self,
1762
+ namespace: str,
1763
+ data_scan_name: str,
1764
+ ) -> catalog_api_models.DataScan:
1765
+ runtime = util_models.RuntimeOptions()
1766
+ return TeaCore.from_map(
1767
+ catalog_api_models.DataScan(),
1768
+ await self.request_with_model_async(catalog_api_models.DataScan(), 'GET', self.get_data_scan_path(namespace, data_scan_name), None, runtime)
1769
+ )
1770
+
1771
+ def list_data_scans(
1772
+ self,
1773
+ namespace: str,
1774
+ page_size: int,
1775
+ page_token: str,
1776
+ ) -> catalog_api_models.ListDataScansResponse:
1777
+ runtime = util_models.RuntimeOptions()
1778
+ path = self.get_data_scans_path(namespace)
1779
+ query = {}
1780
+ if not UtilClient.is_unset(page_size):
1781
+ query['pageSize'] = McUtilClient.to_string(page_size)
1782
+ if not UtilClient.is_unset(page_token):
1783
+ query['pageToken'] = page_token
1784
+ return TeaCore.from_map(
1785
+ catalog_api_models.ListDataScansResponse(),
1786
+ self.request_with_model(catalog_api_models.ListDataScansResponse(), 'GET', path, query, runtime)
1787
+ )
1788
+
1789
+ async def list_data_scans_async(
1790
+ self,
1791
+ namespace: str,
1792
+ page_size: int,
1793
+ page_token: str,
1794
+ ) -> catalog_api_models.ListDataScansResponse:
1795
+ runtime = util_models.RuntimeOptions()
1796
+ path = self.get_data_scans_path(namespace)
1797
+ query = {}
1798
+ if not UtilClient.is_unset(page_size):
1799
+ query['pageSize'] = McUtilClient.to_string(page_size)
1800
+ if not UtilClient.is_unset(page_token):
1801
+ query['pageToken'] = page_token
1802
+ return TeaCore.from_map(
1803
+ catalog_api_models.ListDataScansResponse(),
1804
+ await self.request_with_model_async(catalog_api_models.ListDataScansResponse(), 'GET', path, query, runtime)
1805
+ )
1806
+
1807
+ def get_data_scan_jobs_path(
1808
+ self,
1809
+ namespace: str,
1810
+ data_scan_name: str,
1811
+ ) -> str:
1812
+ return f'/api/catalog/v1alpha/namespaces/{namespace}/dataScans/{data_scan_name}/scanJobs'
1813
+
1814
+ def list_data_scan_jobs(
1815
+ self,
1816
+ namespace: str,
1817
+ data_scan_name: str,
1818
+ page_size: int,
1819
+ page_token: str,
1820
+ ) -> catalog_api_models.ListDataScanJobsResponse:
1821
+ runtime = util_models.RuntimeOptions()
1822
+ path = self.get_data_scan_jobs_path(namespace, data_scan_name)
1823
+ query = {}
1824
+ if not UtilClient.is_unset(page_size):
1825
+ query['pageSize'] = McUtilClient.to_string(page_size)
1826
+ if not UtilClient.is_unset(page_token):
1827
+ query['pageToken'] = page_token
1828
+ return TeaCore.from_map(
1829
+ catalog_api_models.ListDataScanJobsResponse(),
1830
+ self.request_with_model(catalog_api_models.ListDataScanJobsResponse(), 'GET', path, query, runtime)
1831
+ )
1832
+
1833
+ async def list_data_scan_jobs_async(
1834
+ self,
1835
+ namespace: str,
1836
+ data_scan_name: str,
1837
+ page_size: int,
1838
+ page_token: str,
1839
+ ) -> catalog_api_models.ListDataScanJobsResponse:
1840
+ runtime = util_models.RuntimeOptions()
1841
+ path = self.get_data_scan_jobs_path(namespace, data_scan_name)
1842
+ query = {}
1843
+ if not UtilClient.is_unset(page_size):
1844
+ query['pageSize'] = McUtilClient.to_string(page_size)
1845
+ if not UtilClient.is_unset(page_token):
1846
+ query['pageToken'] = page_token
1847
+ return TeaCore.from_map(
1848
+ catalog_api_models.ListDataScanJobsResponse(),
1849
+ await self.request_with_model_async(catalog_api_models.ListDataScanJobsResponse(), 'GET', path, query, runtime)
1850
+ )
1851
+
1852
+ def get_model_path(
1853
+ self,
1854
+ project_id: str,
1855
+ schema_name: str,
1856
+ model_name: str,
1857
+ version_name: str,
1858
+ ) -> str:
1859
+ """
1860
+ 路径生成函数
1861
+ """
1862
+ if UtilClient.is_unset(version_name):
1863
+ return f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}'
1864
+ else:
1865
+ return f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}@{version_name}'
1866
+
1867
+ def create_model(
1868
+ self,
1869
+ project_id: str,
1870
+ schema_name: str,
1871
+ model: catalog_api_models.Model,
1872
+ ) -> catalog_api_models.Model:
1873
+ """
1874
+ 创建模型
1875
+ """
1876
+ runtime = util_models.RuntimeOptions()
1877
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models'
1878
+ return TeaCore.from_map(
1879
+ catalog_api_models.Model(),
1880
+ self.request_with_model(model, 'POST', path, None, runtime)
1881
+ )
1882
+
1883
+ async def create_model_async(
1884
+ self,
1885
+ project_id: str,
1886
+ schema_name: str,
1887
+ model: catalog_api_models.Model,
1888
+ ) -> catalog_api_models.Model:
1889
+ """
1890
+ 创建模型
1891
+ """
1892
+ runtime = util_models.RuntimeOptions()
1893
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models'
1894
+ return TeaCore.from_map(
1895
+ catalog_api_models.Model(),
1896
+ await self.request_with_model_async(model, 'POST', path, None, runtime)
1897
+ )
1898
+
1899
+ def list_models(
1900
+ self,
1901
+ project_id: str,
1902
+ schema_name: str,
1903
+ page_size: int,
1904
+ page_token: str,
1905
+ ) -> catalog_api_models.ListModelsResponse:
1906
+ """
1907
+ 列出模型
1908
+ """
1909
+ runtime = util_models.RuntimeOptions()
1910
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models'
1911
+ query = {}
1912
+ if not UtilClient.is_unset(page_size):
1913
+ query['pageSize'] = McUtilClient.to_string(page_size)
1914
+ if not UtilClient.is_unset(page_token):
1915
+ query['pageToken'] = page_token
1916
+ return TeaCore.from_map(
1917
+ catalog_api_models.ListModelsResponse(),
1918
+ self.request_with_model(catalog_api_models.ListModelsResponse(), 'GET', path, query, runtime)
1919
+ )
1920
+
1921
+ async def list_models_async(
1922
+ self,
1923
+ project_id: str,
1924
+ schema_name: str,
1925
+ page_size: int,
1926
+ page_token: str,
1927
+ ) -> catalog_api_models.ListModelsResponse:
1928
+ """
1929
+ 列出模型
1930
+ """
1931
+ runtime = util_models.RuntimeOptions()
1932
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models'
1933
+ query = {}
1934
+ if not UtilClient.is_unset(page_size):
1935
+ query['pageSize'] = McUtilClient.to_string(page_size)
1936
+ if not UtilClient.is_unset(page_token):
1937
+ query['pageToken'] = page_token
1938
+ return TeaCore.from_map(
1939
+ catalog_api_models.ListModelsResponse(),
1940
+ await self.request_with_model_async(catalog_api_models.ListModelsResponse(), 'GET', path, query, runtime)
1941
+ )
1942
+
1943
+ def get_model(
1944
+ self,
1945
+ project_id: str,
1946
+ schema_name: str,
1947
+ model_name: str,
1948
+ version_name: str,
1949
+ ) -> catalog_api_models.Model:
1950
+ """
1951
+ 获取模型
1952
+ """
1953
+ runtime = util_models.RuntimeOptions()
1954
+ path = self.get_model_path(project_id, schema_name, model_name, version_name)
1955
+ return TeaCore.from_map(
1956
+ catalog_api_models.Model(),
1957
+ self.request_with_model(catalog_api_models.Model(), 'GET', path, None, runtime)
1958
+ )
1959
+
1960
+ async def get_model_async(
1961
+ self,
1962
+ project_id: str,
1963
+ schema_name: str,
1964
+ model_name: str,
1965
+ version_name: str,
1966
+ ) -> catalog_api_models.Model:
1967
+ """
1968
+ 获取模型
1969
+ """
1970
+ runtime = util_models.RuntimeOptions()
1971
+ path = self.get_model_path(project_id, schema_name, model_name, version_name)
1972
+ return TeaCore.from_map(
1973
+ catalog_api_models.Model(),
1974
+ await self.request_with_model_async(catalog_api_models.Model(), 'GET', path, None, runtime)
1975
+ )
1976
+
1977
+ def update_model(
1978
+ self,
1979
+ project_id: str,
1980
+ schema_name: str,
1981
+ model_name: str,
1982
+ model: catalog_api_models.Model,
1983
+ update_mask: str,
1984
+ version_name: str,
1985
+ ) -> catalog_api_models.Model:
1986
+ """
1987
+ 更新模型
1988
+ """
1989
+ runtime = util_models.RuntimeOptions()
1990
+ path = self.get_model_path(project_id, schema_name, model_name, version_name)
1991
+ query = {}
1992
+ if not UtilClient.is_unset(update_mask):
1993
+ query['updateMask'] = update_mask
1994
+ return TeaCore.from_map(
1995
+ catalog_api_models.Model(),
1996
+ self.request_with_model(model, 'PATCH', path, query, runtime)
1997
+ )
1998
+
1999
+ async def update_model_async(
2000
+ self,
2001
+ project_id: str,
2002
+ schema_name: str,
2003
+ model_name: str,
2004
+ model: catalog_api_models.Model,
2005
+ update_mask: str,
2006
+ version_name: str,
2007
+ ) -> catalog_api_models.Model:
2008
+ """
2009
+ 更新模型
2010
+ """
2011
+ runtime = util_models.RuntimeOptions()
2012
+ path = self.get_model_path(project_id, schema_name, model_name, version_name)
2013
+ query = {}
2014
+ if not UtilClient.is_unset(update_mask):
2015
+ query['updateMask'] = update_mask
2016
+ return TeaCore.from_map(
2017
+ catalog_api_models.Model(),
2018
+ await self.request_with_model_async(model, 'PATCH', path, query, runtime)
2019
+ )
2020
+
2021
+ def delete_model(
2022
+ self,
2023
+ project_id: str,
2024
+ schema_name: str,
2025
+ model_name: str,
2026
+ ) -> catalog_api_models.HttpResponse:
2027
+ """
2028
+ 删除模型
2029
+ """
2030
+ runtime = util_models.RuntimeOptions()
2031
+ path = self.get_model_path(project_id, schema_name, model_name, None)
2032
+ return TeaCore.from_map(
2033
+ catalog_api_models.HttpResponse(),
2034
+ self.request_without_model(None, 'DELETE', path, None, runtime)
2035
+ )
2036
+
2037
+ async def delete_model_async(
2038
+ self,
2039
+ project_id: str,
2040
+ schema_name: str,
2041
+ model_name: str,
2042
+ ) -> catalog_api_models.HttpResponse:
2043
+ """
2044
+ 删除模型
2045
+ """
2046
+ runtime = util_models.RuntimeOptions()
2047
+ path = self.get_model_path(project_id, schema_name, model_name, None)
2048
+ return TeaCore.from_map(
2049
+ catalog_api_models.HttpResponse(),
2050
+ await self.request_without_model_async(None, 'DELETE', path, None, runtime)
2051
+ )
2052
+
2053
+ def create_model_version(
2054
+ self,
2055
+ project_id: str,
2056
+ schema_name: str,
2057
+ model_name: str,
2058
+ model: catalog_api_models.Model,
2059
+ ) -> catalog_api_models.Model:
2060
+ """
2061
+ 创建模型版本
2062
+ """
2063
+ runtime = util_models.RuntimeOptions()
2064
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}:createVersion'
2065
+ return TeaCore.from_map(
2066
+ catalog_api_models.Model(),
2067
+ self.request_with_model(model, 'POST', path, None, runtime)
2068
+ )
2069
+
2070
+ async def create_model_version_async(
2071
+ self,
2072
+ project_id: str,
2073
+ schema_name: str,
2074
+ model_name: str,
2075
+ model: catalog_api_models.Model,
2076
+ ) -> catalog_api_models.Model:
2077
+ """
2078
+ 创建模型版本
2079
+ """
2080
+ runtime = util_models.RuntimeOptions()
2081
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}:createVersion'
2082
+ return TeaCore.from_map(
2083
+ catalog_api_models.Model(),
2084
+ await self.request_with_model_async(model, 'POST', path, None, runtime)
2085
+ )
2086
+
2087
+ def delete_model_version(
2088
+ self,
2089
+ project_id: str,
2090
+ schema_name: str,
2091
+ model_name: str,
2092
+ version_name: str,
2093
+ ) -> catalog_api_models.HttpResponse:
2094
+ """
2095
+ 删除模型版本
2096
+ """
2097
+ runtime = util_models.RuntimeOptions()
2098
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}@{version_name}:deleteVersion'
2099
+ return TeaCore.from_map(
2100
+ catalog_api_models.HttpResponse(),
2101
+ self.request_without_model(None, 'DELETE', path, None, runtime)
2102
+ )
2103
+
2104
+ async def delete_model_version_async(
2105
+ self,
2106
+ project_id: str,
2107
+ schema_name: str,
2108
+ model_name: str,
2109
+ version_name: str,
2110
+ ) -> catalog_api_models.HttpResponse:
2111
+ """
2112
+ 删除模型版本
2113
+ """
2114
+ runtime = util_models.RuntimeOptions()
2115
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}@{version_name}:deleteVersion'
2116
+ return TeaCore.from_map(
2117
+ catalog_api_models.HttpResponse(),
2118
+ await self.request_without_model_async(None, 'DELETE', path, None, runtime)
2119
+ )
2120
+
2121
+ def list_model_versions(
2122
+ self,
2123
+ project_id: str,
2124
+ schema_name: str,
2125
+ model_name: str,
2126
+ page_size: int,
2127
+ page_token: str,
2128
+ ) -> catalog_api_models.ListModelVersionsResponse:
2129
+ """
2130
+ 列出模型版本
2131
+ """
2132
+ runtime = util_models.RuntimeOptions()
2133
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}:listVersions'
2134
+ query = {}
2135
+ if not UtilClient.is_unset(page_size):
2136
+ query['pageSize'] = McUtilClient.to_string(page_size)
2137
+ if not UtilClient.is_unset(page_token):
2138
+ query['pageToken'] = page_token
2139
+ return TeaCore.from_map(
2140
+ catalog_api_models.ListModelVersionsResponse(),
2141
+ self.request_with_model(catalog_api_models.ListModelVersionsResponse(), 'GET', path, query, runtime)
2142
+ )
2143
+
2144
+ async def list_model_versions_async(
2145
+ self,
2146
+ project_id: str,
2147
+ schema_name: str,
2148
+ model_name: str,
2149
+ page_size: int,
2150
+ page_token: str,
2151
+ ) -> catalog_api_models.ListModelVersionsResponse:
2152
+ """
2153
+ 列出模型版本
2154
+ """
2155
+ runtime = util_models.RuntimeOptions()
2156
+ path = f'/api/catalog/v1alpha/projects/{project_id}/schemas/{schema_name}/models/{model_name}:listVersions'
2157
+ query = {}
2158
+ if not UtilClient.is_unset(page_size):
2159
+ query['pageSize'] = McUtilClient.to_string(page_size)
2160
+ if not UtilClient.is_unset(page_token):
2161
+ query['pageToken'] = page_token
2162
+ return TeaCore.from_map(
2163
+ catalog_api_models.ListModelVersionsResponse(),
2164
+ await self.request_with_model_async(catalog_api_models.ListModelVersionsResponse(), 'GET', path, query, runtime)
2165
+ )
2166
+
2167
+ def get_model_policy(
2168
+ self,
2169
+ project_id: str,
2170
+ schema_name: str,
2171
+ model_name: str,
2172
+ ) -> catalog_api_models.Policy:
2173
+ """
2174
+ 获取模型策略
2175
+ """
2176
+ runtime = util_models.RuntimeOptions()
2177
+ path = self.get_model_path(project_id, schema_name, model_name, None)
2178
+ query = {}
2179
+ query['method'] = 'getPolicy'
2180
+ return TeaCore.from_map(
2181
+ catalog_api_models.Policy(),
2182
+ self.request_with_model(catalog_api_models.Policy(), 'POST', path, query, runtime)
2183
+ )
2184
+
2185
+ async def get_model_policy_async(
2186
+ self,
2187
+ project_id: str,
2188
+ schema_name: str,
2189
+ model_name: str,
2190
+ ) -> catalog_api_models.Policy:
2191
+ """
2192
+ 获取模型策略
2193
+ """
2194
+ runtime = util_models.RuntimeOptions()
2195
+ path = self.get_model_path(project_id, schema_name, model_name, None)
2196
+ query = {}
2197
+ query['method'] = 'getPolicy'
2198
+ return TeaCore.from_map(
2199
+ catalog_api_models.Policy(),
2200
+ await self.request_with_model_async(catalog_api_models.Policy(), 'POST', path, query, runtime)
2201
+ )
2202
+
2203
+ def set_model_policy(
2204
+ self,
2205
+ project_id: str,
2206
+ schema_name: str,
2207
+ model_name: str,
2208
+ policy: catalog_api_models.Policy,
2209
+ ) -> catalog_api_models.Policy:
2210
+ """
2211
+ 设置模型策略
2212
+ """
2213
+ runtime = util_models.RuntimeOptions()
2214
+ path = self.get_model_path(project_id, schema_name, model_name, None)
2215
+ query = {}
2216
+ query['method'] = 'setPolicy'
2217
+ return TeaCore.from_map(
2218
+ catalog_api_models.Policy(),
2219
+ self.request_with_model(policy, 'POST', path, query, runtime)
2220
+ )
2221
+
2222
+ async def set_model_policy_async(
2223
+ self,
2224
+ project_id: str,
2225
+ schema_name: str,
2226
+ model_name: str,
2227
+ policy: catalog_api_models.Policy,
2228
+ ) -> catalog_api_models.Policy:
2229
+ """
2230
+ 设置模型策略
2231
+ """
2232
+ runtime = util_models.RuntimeOptions()
2233
+ path = self.get_model_path(project_id, schema_name, model_name, None)
2234
+ query = {}
2235
+ query['method'] = 'setPolicy'
2236
+ return TeaCore.from_map(
2237
+ catalog_api_models.Policy(),
2238
+ await self.request_with_model_async(policy, 'POST', path, query, runtime)
2239
+ )
2240
+
2241
+ def search(
2242
+ self,
2243
+ namespace_id: str,
2244
+ query: str,
2245
+ page_size: int,
2246
+ page_token: str,
2247
+ order_by: str,
2248
+ ) -> catalog_api_models.SearchResponse:
2249
+ """
2250
+ 搜索指定 namespace 下的各种实体。
2251
+
2252
+ @param namespace_id: 主账号ID,在该主账号范围内执行搜索。
2253
+
2254
+ @param query: 搜索查询串,由 1 个到多个查询条件组成,查询条件之间用逗号 `,` 分隔。
2255
+ - 语法示例:`name:foo,type=TABLE,region=cn-hangzhou`、`description:bar,type=RESOURCE,project=proj`
2256
+ - 查询条件列表:
2257
+ 1. `name:foo`:将 `foo` 作为子字符串与实体名称匹配。
2258
+ 2. `description:bar`:将 `bar` 作为子字符串与实体描述匹配。
2259
+ 3. `type=TABLE`:匹配特定类型的实体(必选)。当前支持 `TABLE`、`RESOURCE`、`SCHEMA`。
2260
+ 4. `project=proj`:仅搜索指定单个 project 下的查询条件。要求调用方拥有该 project 的 `SearchProject` 权限。
2261
+ 5. `project=(proj1|proj2|proj3)`:搜索多个 project 下的实体(最多 512 个)。要求调用方同时拥有这些 projects 的 `SearchProject` 权限。
2262
+ 6. `region=region_id`:搜索指定 region 的 project 下的实体。
2263
+ - 约束:
2264
+ - 查询条件 3 必选。
2265
+ - 查询条件 4 与查询条件 5 不能同时存在。
2266
+ - 查询条件 6 不能与查询条件 4 或 5 同时存在。
2267
+
2268
+ @param page_size: 每页返回结果条数。
2269
+ - 必须 > 0
2270
+ - 最大 100
2271
+
2272
+ @param page_token: 翻页 token;用于从上一次响应的 token 继续获取下一页。
2273
+
2274
+ @param order_by: 结果排序方式。可取值包括:
2275
+ - `default`:内部存储顺序(默认)
2276
+ - `create_time asc`:创建时间正序
2277
+ - `create_time desc`:创建时间倒序
2278
+ - `last_modified_time asc`:最近修改时间正序
2279
+ - `last_modified_time desc`:最近修改时间倒序
2280
+ """
2281
+ runtime = util_models.RuntimeOptions()
2282
+ path = f'/api/catalog/v1alpha/namespaces/{namespace_id}:search'
2283
+ params = {}
2284
+ if not UtilClient.is_unset(page_size):
2285
+ params['pageSize'] = McUtilClient.to_string(page_size)
2286
+ if not UtilClient.is_unset(page_token):
2287
+ params['pageToken'] = page_token
2288
+ if not UtilClient.is_unset(query):
2289
+ params['query'] = McUtilClient.to_string(query)
2290
+ if not UtilClient.is_unset(order_by):
2291
+ params['orderBy'] = McUtilClient.to_string(order_by)
2292
+ return TeaCore.from_map(
2293
+ catalog_api_models.SearchResponse(),
2294
+ self.request_with_model(catalog_api_models.SearchResponse(), 'POST', path, params, runtime)
2295
+ )
2296
+
2297
+ async def search_async(
2298
+ self,
2299
+ namespace_id: str,
2300
+ query: str,
2301
+ page_size: int,
2302
+ page_token: str,
2303
+ order_by: str,
2304
+ ) -> catalog_api_models.SearchResponse:
2305
+ """
2306
+ 搜索指定 namespace 下的各种实体。
2307
+
2308
+ @param namespace_id: 主账号ID,在该主账号范围内执行搜索。
2309
+
2310
+ @param query: 搜索查询串,由 1 个到多个查询条件组成,查询条件之间用逗号 `,` 分隔。
2311
+ - 语法示例:`name:foo,type=TABLE,region=cn-hangzhou`、`description:bar,type=RESOURCE,project=proj`
2312
+ - 查询条件列表:
2313
+ 1. `name:foo`:将 `foo` 作为子字符串与实体名称匹配。
2314
+ 2. `description:bar`:将 `bar` 作为子字符串与实体描述匹配。
2315
+ 3. `type=TABLE`:匹配特定类型的实体(必选)。当前支持 `TABLE`、`RESOURCE`、`SCHEMA`。
2316
+ 4. `project=proj`:仅搜索指定单个 project 下的查询条件。要求调用方拥有该 project 的 `SearchProject` 权限。
2317
+ 5. `project=(proj1|proj2|proj3)`:搜索多个 project 下的实体(最多 512 个)。要求调用方同时拥有这些 projects 的 `SearchProject` 权限。
2318
+ 6. `region=region_id`:搜索指定 region 的 project 下的实体。
2319
+ - 约束:
2320
+ - 查询条件 3 必选。
2321
+ - 查询条件 4 与查询条件 5 不能同时存在。
2322
+ - 查询条件 6 不能与查询条件 4 或 5 同时存在。
2323
+
2324
+ @param page_size: 每页返回结果条数。
2325
+ - 必须 > 0
2326
+ - 最大 100
2327
+
2328
+ @param page_token: 翻页 token;用于从上一次响应的 token 继续获取下一页。
2329
+
2330
+ @param order_by: 结果排序方式。可取值包括:
2331
+ - `default`:内部存储顺序(默认)
2332
+ - `create_time asc`:创建时间正序
2333
+ - `create_time desc`:创建时间倒序
2334
+ - `last_modified_time asc`:最近修改时间正序
2335
+ - `last_modified_time desc`:最近修改时间倒序
2336
+ """
2337
+ runtime = util_models.RuntimeOptions()
2338
+ path = f'/api/catalog/v1alpha/namespaces/{namespace_id}:search'
2339
+ params = {}
2340
+ if not UtilClient.is_unset(page_size):
2341
+ params['pageSize'] = McUtilClient.to_string(page_size)
2342
+ if not UtilClient.is_unset(page_token):
2343
+ params['pageToken'] = page_token
2344
+ if not UtilClient.is_unset(query):
2345
+ params['query'] = McUtilClient.to_string(query)
2346
+ if not UtilClient.is_unset(order_by):
2347
+ params['orderBy'] = McUtilClient.to_string(order_by)
2348
+ return TeaCore.from_map(
2349
+ catalog_api_models.SearchResponse(),
2350
+ await self.request_with_model_async(catalog_api_models.SearchResponse(), 'POST', path, params, runtime)
2351
+ )