-
Notifications
You must be signed in to change notification settings - Fork 447
Expand file tree
/
Copy pathtableau_types.py
More file actions
33 lines (26 loc) · 918 Bytes
/
tableau_types.py
File metadata and controls
33 lines (26 loc) · 918 Bytes
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
from typing import Union
from .datasource_item import DatasourceItem
from .flow_item import FlowItem
from .project_item import ProjectItem
from .view_item import ViewItem
from .workbook_item import WorkbookItem
from .metric_item import MetricItem
class Resource:
Database = "database"
Datarole = "datarole"
Table = "table"
Datasource = "datasource"
Flow = "flow"
Lens = "lens"
Metric = "metric"
Project = "project"
View = "view"
Workbook = "workbook"
# resource types that have permissions, can be renamed, etc
# todo: refactoring: should actually define TableauItem as an interface and let all these implement it
TableauItem = Union[DatasourceItem, FlowItem, MetricItem, ProjectItem, ViewItem, WorkbookItem]
def plural_type(content_type: Resource) -> str:
if content_type == Resource.Lens:
return "lenses"
else:
return "{}s".format(content_type)