diaspora-event-sdk 0.1.5__py3-none-any.whl → 0.1.7__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.
- diaspora_event_sdk/sdk/_environments.py +1 -1
- diaspora_event_sdk/sdk/client.py +36 -26
- diaspora_event_sdk/sdk/web_client.py +44 -37
- diaspora_event_sdk/version.py +1 -1
- {diaspora_event_sdk-0.1.5.dist-info → diaspora_event_sdk-0.1.7.dist-info}/METADATA +3 -1
- {diaspora_event_sdk-0.1.5.dist-info → diaspora_event_sdk-0.1.7.dist-info}/RECORD +9 -9
- {diaspora_event_sdk-0.1.5.dist-info → diaspora_event_sdk-0.1.7.dist-info}/WHEEL +1 -1
- {diaspora_event_sdk-0.1.5.dist-info → diaspora_event_sdk-0.1.7.dist-info}/LICENSE +0 -0
- {diaspora_event_sdk-0.1.5.dist-info → diaspora_event_sdk-0.1.7.dist-info}/top_level.txt +0 -0
diaspora_event_sdk/sdk/client.py
CHANGED
|
@@ -89,16 +89,6 @@ class Client:
|
|
|
89
89
|
"endpoint": tokens["endpoint"],
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
# @requires_login # TODO
|
|
93
|
-
# def get_secret_key(self):
|
|
94
|
-
# tokens = self.login_manager._token_storage.get_token_data(
|
|
95
|
-
# DIASPORA_RESOURCE_SERVER
|
|
96
|
-
# )
|
|
97
|
-
# if tokens is None or "secret_key" not in tokens:
|
|
98
|
-
# return None
|
|
99
|
-
# else:
|
|
100
|
-
# return tokens["secret_key"]
|
|
101
|
-
|
|
102
92
|
@requires_login
|
|
103
93
|
def put_secret_key(self, access_key, secret_key, endpoint):
|
|
104
94
|
tokens = self.login_manager._token_storage.get_token_data(
|
|
@@ -133,54 +123,74 @@ class Client:
|
|
|
133
123
|
"""
|
|
134
124
|
Registers a new topic under the user's OpenID.
|
|
135
125
|
"""
|
|
136
|
-
return self.web_client.register_topic(self.subject_openid, topic)
|
|
126
|
+
return self.web_client.register_topic(self.subject_openid, topic, "register")
|
|
137
127
|
|
|
138
128
|
@requires_login
|
|
139
129
|
def unregister_topic(self, topic):
|
|
140
130
|
"""
|
|
141
131
|
Unregisters a topic from the user's OpenID.
|
|
142
132
|
"""
|
|
143
|
-
return self.web_client.
|
|
133
|
+
return self.web_client.register_topic(self.subject_openid, topic, "unregister")
|
|
134
|
+
|
|
135
|
+
@requires_login
|
|
136
|
+
def get_topic_configs(self, topic):
|
|
137
|
+
"""
|
|
138
|
+
Get topic configurations.
|
|
139
|
+
"""
|
|
140
|
+
return self.web_client.get_topic_configs(self.subject_openid, topic)
|
|
144
141
|
|
|
145
142
|
@requires_login
|
|
146
|
-
def
|
|
143
|
+
def update_topic_configs(self, topic, configs):
|
|
144
|
+
"""
|
|
145
|
+
Set topic configurations.
|
|
146
|
+
"""
|
|
147
|
+
return self.web_client.update_topic_configs(self.subject_openid, topic, configs)
|
|
148
|
+
|
|
149
|
+
@requires_login
|
|
150
|
+
def update_topic_partitions(self, topic, new_partitions):
|
|
151
|
+
"""
|
|
152
|
+
Adjust topic number of partitions
|
|
153
|
+
"""
|
|
154
|
+
return self.web_client.update_topic_partitions(self.subject_openid, topic, new_partitions)
|
|
155
|
+
|
|
156
|
+
@requires_login
|
|
157
|
+
def grant_user_access(self, topic, user):
|
|
147
158
|
"""
|
|
148
159
|
Registers a new topic under the user's OpenID.
|
|
149
160
|
"""
|
|
150
|
-
return self.web_client.
|
|
161
|
+
return self.web_client.grant_user_access(self.subject_openid, topic, user, "grant")
|
|
151
162
|
|
|
152
163
|
@requires_login
|
|
153
|
-
def
|
|
164
|
+
def revoke_user_access(self, topic, user):
|
|
154
165
|
"""
|
|
155
166
|
Unregisters a topic from the user's OpenID.
|
|
156
167
|
"""
|
|
157
|
-
return self.web_client.
|
|
158
|
-
|
|
168
|
+
return self.web_client.grant_user_access(self.subject_openid, topic, user, "revoke")
|
|
159
169
|
|
|
160
170
|
@requires_login
|
|
161
|
-
def
|
|
171
|
+
def list_triggers(self):
|
|
162
172
|
"""
|
|
163
173
|
Retrieves the list of functions associated with the user's OpenID.
|
|
164
174
|
"""
|
|
165
|
-
return self.web_client.
|
|
175
|
+
return self.web_client.list_triggers(self.subject_openid)
|
|
166
176
|
|
|
167
177
|
@requires_login
|
|
168
|
-
def
|
|
178
|
+
def create_trigger(self, topic, function, function_configs):
|
|
169
179
|
"""
|
|
170
180
|
Registers a new functions under the user's OpenID.
|
|
171
181
|
"""
|
|
172
|
-
return self.web_client.
|
|
182
|
+
return self.web_client.create_trigger(self.subject_openid, topic, function, "create", function_configs)
|
|
173
183
|
|
|
174
184
|
@requires_login
|
|
175
|
-
def
|
|
185
|
+
def delete_trigger(self, topic, function):
|
|
176
186
|
"""
|
|
177
187
|
Unregisters a functions from the user's OpenID.
|
|
178
188
|
"""
|
|
179
|
-
return self.web_client.
|
|
180
|
-
|
|
189
|
+
return self.web_client.create_trigger(self.subject_openid, topic, function, "delete", {})
|
|
190
|
+
|
|
181
191
|
@requires_login
|
|
182
|
-
def
|
|
192
|
+
def update_trigger(self, trigger_uuid, trigger_configs):
|
|
183
193
|
"""
|
|
184
194
|
Update a functions's trigger'.
|
|
185
195
|
"""
|
|
186
|
-
return self.web_client.
|
|
196
|
+
return self.web_client.update_trigger(self.subject_openid, trigger_uuid, trigger_configs)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
|
-
|
|
2
|
+
import json
|
|
3
3
|
import globus_sdk
|
|
4
4
|
from diaspora_event_sdk.sdk.utils.uuid_like import UUID_LIKE_T
|
|
5
5
|
|
|
@@ -24,69 +24,76 @@ class WebClient(globus_sdk.BaseClient):
|
|
|
24
24
|
self.user_app_name = app_name
|
|
25
25
|
|
|
26
26
|
def create_key(self, subject: UUID_LIKE_T) -> globus_sdk.GlobusHTTPResponse:
|
|
27
|
-
return self.
|
|
27
|
+
return self.get("/api/v2/create_key", headers={"Subject": str(subject)})
|
|
28
28
|
|
|
29
29
|
def list_topics(self, subject: UUID_LIKE_T) -> globus_sdk.GlobusHTTPResponse:
|
|
30
|
-
return self.get("/
|
|
30
|
+
return self.get("/api/v2/topics", headers={"Subject": str(subject)})
|
|
31
31
|
|
|
32
32
|
def register_topic(
|
|
33
|
-
self, subject: UUID_LIKE_T, topic: str
|
|
33
|
+
self, subject: UUID_LIKE_T, topic: str, action: str
|
|
34
34
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
35
|
-
return self.
|
|
36
|
-
"/
|
|
35
|
+
return self.put(
|
|
36
|
+
f"/api/v2/topic/{topic}", headers={"Subject": str(subject), "Action": action}
|
|
37
37
|
)
|
|
38
38
|
|
|
39
|
-
def
|
|
39
|
+
def get_topic_configs(
|
|
40
40
|
self, subject: UUID_LIKE_T, topic: str
|
|
41
41
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
42
|
-
return self.
|
|
43
|
-
"/
|
|
42
|
+
return self.get(
|
|
43
|
+
f"/api/v2/topic/{topic}",
|
|
44
|
+
headers={"Subject": str(subject), "Topic": topic},
|
|
45
|
+
# data=json.dumps(configs).encode("utf-8")
|
|
44
46
|
)
|
|
45
47
|
|
|
46
|
-
def
|
|
47
|
-
self, subject: UUID_LIKE_T, topic: str,
|
|
48
|
+
def update_topic_configs(
|
|
49
|
+
self, subject: UUID_LIKE_T, topic: str, configs: dict
|
|
48
50
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
49
51
|
return self.post(
|
|
50
|
-
"/
|
|
51
|
-
headers={"Subject": str(
|
|
52
|
-
|
|
52
|
+
f"/api/v2/topic/{topic}",
|
|
53
|
+
headers={"Subject": str(subject), "Topic": topic,
|
|
54
|
+
"Content-Type": "text/plain"},
|
|
55
|
+
data=json.dumps(configs).encode("utf-8")
|
|
53
56
|
)
|
|
54
57
|
|
|
55
|
-
def
|
|
56
|
-
self, subject: UUID_LIKE_T, topic: str,
|
|
58
|
+
def update_topic_partitions(
|
|
59
|
+
self, subject: UUID_LIKE_T, topic: str, new_partitions: int
|
|
57
60
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
58
61
|
return self.post(
|
|
59
|
-
"/
|
|
60
|
-
headers={"Subject": str(
|
|
61
|
-
|
|
62
|
+
f"/api/v2/topic/{topic}/partitions",
|
|
63
|
+
headers={"Subject": str(subject), "Topic": topic,
|
|
64
|
+
"NewPartitions": str(new_partitions)},
|
|
62
65
|
)
|
|
63
66
|
|
|
64
|
-
def
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def register_function(
|
|
68
|
-
self, subject: UUID_LIKE_T, topic: str, function: str,
|
|
69
|
-
function_configs: dict
|
|
67
|
+
def grant_user_access(
|
|
68
|
+
self, subject: UUID_LIKE_T, topic: str, user: UUID_LIKE_T, action: str
|
|
70
69
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
71
70
|
return self.post(
|
|
72
|
-
"/
|
|
73
|
-
headers={"Subject": str(subject), "
|
|
74
|
-
"
|
|
75
|
-
data=function_configs
|
|
71
|
+
f"/api/v2/topic/{topic}/user",
|
|
72
|
+
headers={"Subject": str(subject), "Action": action,
|
|
73
|
+
"Topic": topic, "User": str(user)}
|
|
76
74
|
)
|
|
77
75
|
|
|
78
|
-
def
|
|
79
|
-
self,
|
|
76
|
+
def list_triggers(self, subject: UUID_LIKE_T) -> globus_sdk.GlobusHTTPResponse:
|
|
77
|
+
return self.get("/api/v2/triggers", headers={"Subject": str(subject)})
|
|
78
|
+
|
|
79
|
+
def create_trigger(
|
|
80
|
+
self, subject: UUID_LIKE_T, topic: str, function: str, action: str,
|
|
81
|
+
function_configs: dict
|
|
80
82
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
81
|
-
return self.
|
|
82
|
-
"/
|
|
83
|
+
return self.put(
|
|
84
|
+
"/api/v2/trigger",
|
|
85
|
+
headers={"Subject": str(subject), "Topic": topic,
|
|
86
|
+
"Trigger": function, "Action": action,
|
|
87
|
+
"Content-Type": "text/plain"},
|
|
88
|
+
data=json.dumps(function_configs).encode("utf-8")
|
|
83
89
|
)
|
|
84
90
|
|
|
85
|
-
def
|
|
91
|
+
def update_trigger(
|
|
86
92
|
self, subject: UUID_LIKE_T, trigger_uuid: UUID_LIKE_T, trigger_configs: dict
|
|
87
93
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
88
94
|
return self.post(
|
|
89
|
-
"/
|
|
90
|
-
headers={"Subject": str(subject), "
|
|
91
|
-
|
|
95
|
+
f"/api/v2/triggers/{trigger_uuid}",
|
|
96
|
+
headers={"Subject": str(subject), "Trigger_id": str(trigger_uuid),
|
|
97
|
+
"Content-Type": "text/plain"},
|
|
98
|
+
data=json.dumps(trigger_configs).encode("utf-8")
|
|
92
99
|
)
|
diaspora_event_sdk/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.7"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diaspora-event-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: SDK of Diaspora Event Fabric: Resilience-enabling services for science from HPC to edge
|
|
5
5
|
Home-page: https://github.com/globus-labs/diaspora-event-sdk
|
|
6
6
|
License: LICENSE
|
|
7
|
+
Platform: UNKNOWN
|
|
7
8
|
Description-Content-Type: text/markdown
|
|
8
9
|
License-File: LICENSE
|
|
9
10
|
Requires-Dist: globus-sdk <4,>=3.20.1
|
|
@@ -47,3 +48,4 @@ Note: This method does not include dependencies for `KafkaProducer` and `KafkaCo
|
|
|
47
48
|
**Advanced Consumers with Faust**: Explore the [Faust Streaming Guide](docs/faust_weather_app.md) for advanced event streaming with Faust.
|
|
48
49
|
|
|
49
50
|
**Advanced Consumer Functions**: See our [Colab example](https://colab.research.google.com/drive/1tPKfxU2qPsLvNTreF6nKINU62k7pQWxa?usp=sharing) for demonstration.
|
|
51
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
diaspora_event_sdk/__init__.py,sha256=v8IN3-WFpliakQKru8TAcmQ4IRdvRe_m9-abSDnGIFM,457
|
|
2
|
-
diaspora_event_sdk/version.py,sha256=
|
|
2
|
+
diaspora_event_sdk/version.py,sha256=YpKDcdV7CqL8n45u267wKtyloM13FSVbOdrqgNZnSLM,22
|
|
3
3
|
diaspora_event_sdk/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
diaspora_event_sdk/sdk/_environments.py,sha256=
|
|
5
|
-
diaspora_event_sdk/sdk/client.py,sha256=
|
|
4
|
+
diaspora_event_sdk/sdk/_environments.py,sha256=QyQA7dV4goUKUoxAoaes8OGv0xKxz2qiFBHNGr-vQNA,204
|
|
5
|
+
diaspora_event_sdk/sdk/client.py,sha256=kEgcxdi2bwHXD1sVFZUZflPf9RD6FRhXteoe5A20n9s,6834
|
|
6
6
|
diaspora_event_sdk/sdk/decorators.py,sha256=Gel8AyhIjbf4-FNintTNcOqvC9hHH_YwbOH257Nfmf0,884
|
|
7
7
|
diaspora_event_sdk/sdk/kafka_client.py,sha256=G1kQQz2TWlahdd2TDdpvaQW7HD7gsuQCnr0tks54ISw,4361
|
|
8
|
-
diaspora_event_sdk/sdk/web_client.py,sha256=
|
|
8
|
+
diaspora_event_sdk/sdk/web_client.py,sha256=6hijsiTF23miM3u2n6MRS4mQANi09M-5IKtlaTZjDqA,3630
|
|
9
9
|
diaspora_event_sdk/sdk/login_manager/__init__.py,sha256=yeqVgjeHLMX0WZJu2feJmq-fbeXvSxWghVV81ygfY-w,239
|
|
10
10
|
diaspora_event_sdk/sdk/login_manager/client_login.py,sha256=gvR4PkIqQpIywNieJQ_u11PHUmdLxQ0Ho-QgPSfu8bw,1798
|
|
11
11
|
diaspora_event_sdk/sdk/login_manager/decorators.py,sha256=EFEp71d0oJ7vo2H8W7DJ2gPrDfGzeNXUNxri1C0l8h0,1047
|
|
@@ -18,8 +18,8 @@ diaspora_event_sdk/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
|
18
18
|
diaspora_event_sdk/sdk/utils/uuid_like.py,sha256=xbxf0YXpDhdii16lwPLWRN21qFekHrNrqODSToMPtCg,470
|
|
19
19
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
tests/unit/test_client.py,sha256=alUC-XTRQn_Oz0RvmzXTal-ciSVtCpx5jm3NuStkt1E,2995
|
|
21
|
-
diaspora_event_sdk-0.1.
|
|
22
|
-
diaspora_event_sdk-0.1.
|
|
23
|
-
diaspora_event_sdk-0.1.
|
|
24
|
-
diaspora_event_sdk-0.1.
|
|
25
|
-
diaspora_event_sdk-0.1.
|
|
21
|
+
diaspora_event_sdk-0.1.7.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
22
|
+
diaspora_event_sdk-0.1.7.dist-info/METADATA,sha256=FzdEwxOwp7qNG5hCokv4N803ritlaZt0bRy4j3rJmhU,2505
|
|
23
|
+
diaspora_event_sdk-0.1.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
24
|
+
diaspora_event_sdk-0.1.7.dist-info/top_level.txt,sha256=OVun-67t3fkLFEIwvJuNINgFFvAc--bClYhXjLhMmvs,25
|
|
25
|
+
diaspora_event_sdk-0.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|