8000 Initial changes. I will add a sample · mirror-dump/server-client-python@8dc6ae3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8dc6ae3

Browse files
committed
Initial changes. I will add a sample
1 parent 97747b7 commit 8dc6ae3

File tree

6 files changed

+44
-1
lines changed

6 files changed

+44
-1
lines changed

tableauserverclient/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
HourlyInterval,
1717
IntervalItem,
1818
JobItem,
19+
JsonWebTokenAuth,
1920
MetricItem,
2021
MonthlyInterval,
2122
PaginationItem,

tableauserverclient/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from .site_item import SiteItem
3030
from .subscription_item import SubscriptionItem
3131
from .table_item import TableItem
32-
from .tableau_auth import Credentials, TableauAuth, PersonalAccessTokenAuth
32+
from .tableau_auth import Credentials, TableauAuth, PersonalAccessTokenAuth, JsonWebTokenAuth
3333
from .tableau_types import Resource, TableauItem, plural_type
3434
from .target import Target
3535
from .task_item import TaskItem

tableauserverclient/models/site_item.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def __init__(
9494
time_zone=None,
9595
auto_suspend_refresh_enabled: bool = True,
9696
auto_suspend_refresh_inactivity_window: int = 30,
97+
attribute_capture_enabled: bool = True,
9798
):
9899
self._admin_mode = None
99100
self._id: Optional[str] = None
@@ -147,6 +148,7 @@ def __init__(
147148
self.time_zone = time_zone
148149
self.auto_suspend_refresh_enabled = auto_suspend_refresh_enabled
149150
self.auto_suspend_refresh_inactivity_window = auto_suspend_refresh_inactivity_window
151+
self.attrbute_capture_enabled = attribute_capture_enabled
150152

151153
@property
152154
def admin_mode(self) -> Optional[str]:
@@ -588,6 +590,14 @@ def auto_suspend_refresh_enabled(self) -> bool:
588590
def auto_suspend_refresh_enabled(self, value: bool):
589591
self._auto_suspend_refresh_enabled = value
590592

593+
@property
594+
def attribute_capture_enabled(self) -> bool:
595+
return self._attribute_capture_enabled
596+
597+
@attribute_capture_enabled.setter
598+
def attribute_capture_enabled(self, value: bool):
599+
self._attribute_capture_enabled = value
600+
591601
def replace_license_tiers_with_user_quota(self, value: int) -> None:
592602
self.tier_creator_capacity = None
593603
self.tier_explorer_capacity = None
@@ -650,6 +660,7 @@ def _parse_common_tags(self, site_xml, ns):
650660
time_zone,
651661
auto_suspend_refresh_enabled,
652662
auto_suspend_refresh_inactivity_window,
663+
aatribute_capture_enabled,
653664
) = self._parse_element(site_xml, ns)
654665

655666
self._set_values(
@@ -704,6 +715,7 @@ def _parse_common_tags(self, site_xml, ns):
704715
time_zone,
705716
auto_suspend_refresh_enabled,
706717
auto_suspend_refresh_inactivity_window,
718+
attribute_capture_enabled,
707719
)
708720
return self
709721

@@ -760,6 +772,7 @@ def _set_values(
760772
time_zone,
761773
auto_suspend_refresh_enabled,
762774
auto_suspend_refresh_inactivity_window,
775+
attribute_capture_enabled,
763776
):
764777
if id is not None:
765778
self._id = id
@@ -867,6 +880,8 @@ def _set_values(
867880
self.auto_suspend_refresh_enabled = auto_suspend_refresh_enabled
868881
if auto_suspend_refresh_inactivity_window is not None:
869882
self.auto_suspend_refresh_inactivity_window = auto_suspend_refresh_inactivity_window
883+
if attribute_capture_enabled is not None:
884+
self.attribute_capture_enabled = attribute_capture_enabled
870885

871886
@classmethod
872887
def from_response(cls, resp, ns) -> List["SiteItem"]:
@@ -926,6 +941,7 @@ def from_response(cls, resp, ns) -> List["SiteItem"]:
926941
time_zone,
927942
auto_suspend_refresh_enabled,
928943
auto_suspend_refresh_inactivity_window,
944+
attribute_capture_enabled,
929945
) = cls._parse_element(site_xml, ns)
930946

931947
site_item = cls(name, content_url)
@@ -981,6 +997,7 @@ def from_response(cls, resp, ns) -> List["SiteItem"]:
981997
time_zone,
982998
auto_suspend_refresh_enabled,
983999
auto_suspend_refresh_inactivity_window,
1000+
attribute_capture_enabled,
9841001
)
9851002
all_site_items.append(site_item)
9861003
return all_site_items
@@ -1062,6 +1079,7 @@ def _parse_element(site_xml, ns):
10621079

10631080
flows_enabled = string_to_bool(site_xml.get("flowsEnabled", ""))
10641081
cataloging_enabled = string_to_bool(site_xml.get("catalogingEnabled", ""))
1082+
attribute_capture_enbaled = string_to_bool(site_xml.get("attributeCaptureEnabled", ""))
10651083

10661084
return (
10671085
id,
@@ -1115,6 +1133,7 @@ def _parse_element(site_xml, ns):
11151133
time_zone,
11161134
auto_suspend_refresh_enabled,
11171135
auto_suspend_refresh_inactivity_window,
1136+
attribute_capture_enbaled,
11181137
)
11191138

11201139

tableauserverclient/models/tableau_auth.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,17 @@ def __repr__(self):
6868
return "<PersonalAccessToken name={} token={}>(site={})".format(
6969
self.token_name, self.personal_access_token[:2] + "...", self.site_id
7070
)
71+
72+
class JsonWebTokenAuth(Credentials):
73+
def __init__(self, json_web_token, site_id=None):
74+
super().__init__(site_id=site_id)
75+
self.json_web_token = json_web_token
76+
77+
@property
78+
def credentials(self):
79+
return {
80+
"jwt": self.json_web_token,
81+
}
82+
83+
def __repr__(self):
84+
return "<jwt={}>".format(self.json_web_token)

tableauserverclient/server/endpoint/auth_endpoint.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def sign_in_with_personal_access_token(self, auth_req):
5555
# We use the same request that username/password login uses.
5656
return self.sign_in(auth_req)
5757

58+
@api(version="3.6")
59+
def sign_in_with_json_web_token(self, auth_req):
60+
# We use the same request that username/password login uses.
61+
return self.sign_in(auth_req)
62+
5863
@api(version="2.0")
5964
def sign_out(self):
6065
url = "{0}/{1}".format(self.baseurl, "signout")

tableauserverclient/server/request_factory.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,8 @@ def update_req(self, site_item: "SiteItem", parent_srv: "Server" = None):
679679
site_element.attrib["autoSuspendRefreshInactivityWindow"] = str(
680680
site_item.auto_suspend_refresh_inactivity_window
681681
)
682+
if site_item.attribute_capture_enabled is not None:
683+
site_element.attrib["attributeCaptureEnabled"] = str(site_item.attribute_capture_enabled).lower()
682684

683685
return ET.tostring(xml_request)
684686

@@ -783,6 +785,8 @@ def create_req(self, site_item: "SiteItem", parent_srv: "Server" = None):
783785
site_element.attrib["autoSuspendRefreshInactivityWindow"] = str(
784786
site_item.auto_suspend_refresh_inactivity_window
785787
)
788+
if site_item.attribute_capture_enabled is not None:
789+
site_element.attrib["attributeCaptureEnabled"] = str(site_item.attribute_capture_enabled).lower()
786790

787791
return ET.tostring(xml_request)
788792

0 commit comments

Comments
 (0)
0