-
Notifications
You must be signed in to change notification settings - Fork 447
Expand file tree
/
Copy pathprojects_endpoint.py
More file actions
850 lines (670 loc) · 29.9 KB
/
Copy pathprojects_endpoint.py
File metadata and controls
850 lines (670 loc) · 29.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
import logging
from tableauserverclient.server.endpoint.default_permissions_endpoint import _DefaultPermissionsEndpoint
from tableauserverclient.server.endpoint.endpoint import QuerysetEndpoint, api, XML_CONTENT_TYPE
from tableauserverclient.server.endpoint.exceptions import MissingRequiredFieldError
from tableauserverclient.server.endpoint.permissions_endpoint import _PermissionsEndpoint
from tableauserverclient.server import RequestFactory, RequestOptions
from tableauserverclient.models.permissions_item import PermissionsRule
from tableauserverclient.models import ProjectItem, PaginationItem, Resource
from typing import Optional, TYPE_CHECKING
from tableauserverclient.server.query import QuerySet
if TYPE_CHECKING:
from tableauserverclient.server.server import Server
from tableauserverclient.server.request_options import RequestOptions
from tableauserverclient.helpers.logging import logger
class Projects(QuerysetEndpoint[ProjectItem]):
"""
The project methods are based upon the endpoints for projects in the REST
API and operate on the ProjectItem class.
"""
def __init__(self, parent_srv: "Server") -> None:
super().__init__(parent_srv)
self._permissions = _PermissionsEndpoint(parent_srv, lambda: self.baseurl)
self._default_permissions = _DefaultPermissionsEndpoint(parent_srv, lambda: self.baseurl)
@property
def baseurl(self) -> str:
return f"{self.parent_srv.baseurl}/sites/{self.parent_srv.site_id}/projects"
@api(version="2.0")
def get(self, req_options: Optional["RequestOptions"] = None) -> tuple[list[ProjectItem], PaginationItem]:
"""
Retrieves all projects on the site. The endpoint is paginated and can
be filtered using the req_options parameter.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_projects.htm#query_projects
Parameters
----------
req_options : RequestOptions | None, default None
The request options to filter the projects. The default is None.
Returns
-------
tuple[list[ProjectItem], PaginationItem]
Returns a tuple containing a list of ProjectItem objects and a
PaginationItem object.
"""
logger.info("Querying all projects on site")
url = self.baseurl
server_response = self.get_request(url, req_options)
pagination_item = PaginationItem.from_response(server_response.content, self.parent_srv.namespace)
all_project_items = ProjectItem.from_response(server_response.content, self.parent_srv.namespace)
return all_project_items, pagination_item
@api(version="2.0")
def delete(self, project_id: str) -> None:
"""
Deletes a single project on the site.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_projects.htm#delete_project
Parameters
----------
project_id : str
The unique identifier for the project.
Returns
-------
None
Raises
------
ValueError
If the project ID is not defined, an error is raised.
"""
if not project_id:
error = "Project ID undefined."
raise ValueError(error)
url = f"{self.baseurl}/{project_id}"
self.delete_request(url)
logger.info(f"Deleted single project (ID: {project_id})")
@api(version="2.0")
def update(self, project_item: ProjectItem, samples: bool = False) -> ProjectItem:
"""
Modify the project settings.
You can use this method to update the project name, the project
description, or the project permissions. To specify the site, create a
TableauAuth instance using the content URL for the site (site_id), and
sign in to that site.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_projects.htm#update_project
Parameters
----------
project_item : ProjectItem
The project item object must include the project ID. The values in
the project item override the current project settings.
samples : bool
Set to True to include sample workbooks and data sources in the
project. The default is False.
Returns
-------
ProjectItem
Returns the updated project item.
Raises
------
MissingRequiredFieldError
If the project item is missing the ID, an error is raised.
"""
if not project_item.id:
error = "Project item missing ID."
raise MissingRequiredFieldError(error)
params = {"params": {RequestOptions.Field.PublishSamples: samples}}
url = f"{self.baseurl}/{project_item.id}"
update_req = RequestFactory.Project.update_req(project_item)
server_response = self.put_request(url, update_req, XML_CONTENT_TYPE, params)
logger.info(f"Updated project item (ID: {project_item.id})")
updated_project = ProjectItem.from_response(server_response.content, self.parent_srv.namespace)[0]
return updated_project
@api(version="2.0")
def create(self, project_item: ProjectItem, samples: bool = False) -> ProjectItem:
"""
Creates a project on the specified site.
To create a project, you first create a new instance of a ProjectItem
and pass it to the create method. To specify the site to create the new
project, create a TableauAuth instance using the content URL for the
site (site_id), and sign in to that site.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_projects.htm#create_project
Parameters
----------
project_item : ProjectItem
Specifies the properties for the project. The project_item is the
request package. To create the request package, create a new
instance of ProjectItem.
samples : bool
Set to True to include sample workbooks and data sources in the
project. The default is False.
Returns
-------
ProjectItem
Returns the new project item.
"""
params = {"params": {RequestOptions.Field.PublishSamples: samples}}
url = self.baseurl
if project_item._samples:
url = f"{self.baseurl}?publishSamples={project_item._samples}"
create_req = RequestFactory.Project.create_req(project_item)
server_response = self.post_request(url, create_req, XML_CONTENT_TYPE, params)
new_project = ProjectItem.from_response(server_response.content, self.parent_srv.namespace)[0]
logger.info(f"Created new project (ID: {new_project.id})")
return new_project
@api(version="2.0")
def populate_permissions(self, item: ProjectItem) -> None:
"""
Queries the project permissions, parses and stores the returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_project_permissions
Parameters
----------
item : ProjectItem
The project item to populate with permissions.
Returns
-------
None
"""
self._permissions.populate(item)
@api(version="2.0")
def update_permissions(self, item: ProjectItem, rules: list[PermissionsRule]) -> list[PermissionsRule]:
"""
Updates the permissions for the specified project item. The rules
provided are expected to be a complete list of the permissions for the
project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._permissions.update(item, rules)
@api(version="2.0")
def delete_permission(self, item: ProjectItem, rules: list[PermissionsRule]) -> None:
"""
Deletes the specified permissions from the project item.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_project_permission
Parameters
----------
item : ProjectItem
The project item to delete permissions from.
rules : list[PermissionsRule]
The list of permissions rules to delete from the project.
Returns
-------
None
"""
self._permissions.delete(item, rules)
@api(version="2.1")
def populate_workbook_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default workbook permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default workbook permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Workbook)
@api(version="2.1")
def populate_datasource_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default datasource permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default datasource permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Datasource)
@api(version="3.2")
def populate_metric_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default metric permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default metric permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Metric)
@api(version="3.4")
def populate_datarole_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default datarole permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default datarole permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Datarole)
@api(version="3.4")
def populate_flow_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default flow permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default flow permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Flow)
@api(version="3.4")
def populate_lens_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default lens permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default lens permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Lens)
@api(version="3.23")
def populate_virtualconnection_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default virtualconnections permissions, parses and stores
the returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default virtual connection
permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.VirtualConnection)
@api(version="3.23")
def populate_database_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default database permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default database permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Database)
@api(version="3.23")
def populate_table_default_permissions(self, item: ProjectItem) -> None:
"""
Queries the default table permissions, parses and stores the
returned the permissions.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_default_permissions
Parameters
----------
item : ProjectItem
The project item to populate with default table permissions.
Returns
-------
None
"""
self._default_permissions.populate_default_permissions(item, Resource.Table)
@api(version="2.1")
def update_workbook_default_permissions(
self, item: ProjectItem, rules: list[PermissionsRule]
) -> list[PermissionsRule]:
"""
Add or updates the default workbook permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default workbook permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Workbook)
@api(version="2.1")
def update_datasource_default_permissions(
self, item: ProjectItem, rules: list[PermissionsRule]
) -> list[PermissionsRule]:
"""
Add or updates the default datasource permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default datasource permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Datasource)
@api(version="3.2")
def update_metric_default_permissions(
self, item: ProjectItem, rules: list[PermissionsRule]
) -> list[PermissionsRule]:
"""
Add or updates the default metric permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default metric permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Metric)
@api(version="3.4")
def update_datarole_default_permissions(
self, item: ProjectItem, rules: list[PermissionsRule]
) -> list[PermissionsRule]:
"""
Add or updates the default datarole permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default datarole permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Datarole)
@api(version="3.4")
def update_flow_default_permissions(self, item: ProjectItem, rules: list[PermissionsRule]) -> list[PermissionsRule]:
"""
Add or updates the default flow permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default flow permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Flow)
@api(version="3.4")
def update_lens_default_permissions(self, item: ProjectItem, rules: list[PermissionsRule]) -> list[PermissionsRule]:
"""
Add or updates the default lens permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default lens permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Lens)
@api(version="3.23")
def update_virtualconnection_default_permissions(
self, item: ProjectItem, rules: list[PermissionsRule]
) -> list[PermissionsRule]:
"""
Add or updates the default virtualconnection permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default virtualconnection permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.VirtualConnection)
@api(version="3.23")
def update_database_default_permissions(
self, item: ProjectItem, rules: list[PermissionsRule]
) -> list[PermissionsRule]:
"""
Add or updates the default database permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default database permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Database)
@api(version="3.23")
def update_table_default_permissions(
self, item: ProjectItem, rules: list[PermissionsRule]
) -> list[PermissionsRule]:
"""
Add or updates the default table permissions for the specified.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_default_permissions_for_content
Parameters
----------
item : ProjectItem
The project item to update default table permissions for.
rules : list[PermissionsRule]
The list of permissions rules to update the project with.
Returns
-------
list[PermissionsRule]
Returns the updated list of permissions rules.
"""
return self._default_permissions.update_default_permissions(item, rules, Resource.Table)
@api(version="2.1")
def delete_workbook_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default workbook permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Workbook)
@api(version="2.1")
def delete_datasource_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default datasource permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Datasource)
@api(version="3.2")
def delete_metric_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default workbook permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Metric)
@api(version="3.4")
def delete_datarole_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default datarole permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Datarole)
@api(version="3.4")
def delete_flow_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default flow permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Flow)
@api(version="3.4")
def delete_lens_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default lens permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Lens)
@api(version="3.23")
def delete_virtualconnection_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default virtualconnection permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.VirtualConnection)
@api(version="3.23")
def delete_database_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default database permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Database)
@api(version="3.23")
def delete_table_default_permissions(self, item: ProjectItem, rule: PermissionsRule) -> None:
"""
Deletes the specified default permission rule from the project.
REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_default_permission
Parameters
----------
item : ProjectItem
The project item to delete default table permissions from.
rule : PermissionsRule
The permissions rule to delete from the project.
Returns
-------
None
"""
self._default_permissions.delete_default_permission(item, rule, Resource.Table)
def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[ProjectItem]:
"""
Queries the Tableau Server for items using the specified filters. Page
size can be specified to limit the number of items returned in a single
request. If not specified, the default page size is 100. Page size can
be an integer between 1 and 1000.
No positional arguments are allowed. All filters must be specified as
keyword arguments. If you use the equality operator, you can specify it
through <field_name>=<value>. If you want to use a different operator,
you can specify it through <field_name>__<operator>=<value>. Field
names can either be in snake_case or camelCase.
This endpoint supports the following fields and operators:
created_at=...
created_at__gt=...
created_at__gte=...
created_at__lt=...
created_at__lte=...
name=...
name__in=...
owner_domain=...
owner_domain__in=...
owner_email=...
owner_email__in=...
owner_name=...
owner_name__in=...
parent_project_id=...
parent_project_id__in=...
top_level_project=...
updated_at=...
updated_at__gt=...
updated_at__gte=...
updated_at__lt=...
updated_at__lte=...
"""
return super().filter(*invalid, page_size=page_size, **kwargs)