diaspora-event-sdk 0.1.6__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 +29 -46
- diaspora_event_sdk/sdk/web_client.py +43 -71
- diaspora_event_sdk/version.py +1 -1
- {diaspora_event_sdk-0.1.6.dist-info → diaspora_event_sdk-0.1.7.dist-info}/METADATA +3 -1
- {diaspora_event_sdk-0.1.6.dist-info → diaspora_event_sdk-0.1.7.dist-info}/RECORD +9 -9
- {diaspora_event_sdk-0.1.6.dist-info → diaspora_event_sdk-0.1.7.dist-info}/LICENSE +0 -0
- {diaspora_event_sdk-0.1.6.dist-info → diaspora_event_sdk-0.1.7.dist-info}/WHEEL +0 -0
- {diaspora_event_sdk-0.1.6.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,81 +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.
|
|
144
|
-
|
|
145
|
-
@requires_login
|
|
146
|
-
def register_topic_for_user(self, topic, user):
|
|
147
|
-
"""
|
|
148
|
-
Registers a new topic under the user's OpenID.
|
|
149
|
-
"""
|
|
150
|
-
return self.web_client.register_topic_for_user(self.subject_openid, topic, user)
|
|
133
|
+
return self.web_client.register_topic(self.subject_openid, topic, "unregister")
|
|
151
134
|
|
|
152
135
|
@requires_login
|
|
153
|
-
def
|
|
136
|
+
def get_topic_configs(self, topic):
|
|
154
137
|
"""
|
|
155
|
-
|
|
138
|
+
Get topic configurations.
|
|
156
139
|
"""
|
|
157
|
-
return self.web_client.
|
|
140
|
+
return self.web_client.get_topic_configs(self.subject_openid, topic)
|
|
158
141
|
|
|
159
142
|
@requires_login
|
|
160
|
-
def
|
|
143
|
+
def update_topic_configs(self, topic, configs):
|
|
161
144
|
"""
|
|
162
|
-
|
|
145
|
+
Set topic configurations.
|
|
163
146
|
"""
|
|
164
|
-
return self.web_client.
|
|
147
|
+
return self.web_client.update_topic_configs(self.subject_openid, topic, configs)
|
|
165
148
|
|
|
166
149
|
@requires_login
|
|
167
|
-
def
|
|
150
|
+
def update_topic_partitions(self, topic, new_partitions):
|
|
168
151
|
"""
|
|
169
|
-
|
|
152
|
+
Adjust topic number of partitions
|
|
170
153
|
"""
|
|
171
|
-
return self.web_client.
|
|
154
|
+
return self.web_client.update_topic_partitions(self.subject_openid, topic, new_partitions)
|
|
172
155
|
|
|
173
156
|
@requires_login
|
|
174
|
-
def
|
|
157
|
+
def grant_user_access(self, topic, user):
|
|
175
158
|
"""
|
|
176
|
-
|
|
159
|
+
Registers a new topic under the user's OpenID.
|
|
177
160
|
"""
|
|
178
|
-
return self.web_client.
|
|
161
|
+
return self.web_client.grant_user_access(self.subject_openid, topic, user, "grant")
|
|
179
162
|
|
|
180
163
|
@requires_login
|
|
181
|
-
def
|
|
164
|
+
def revoke_user_access(self, topic, user):
|
|
182
165
|
"""
|
|
183
|
-
|
|
166
|
+
Unregisters a topic from the user's OpenID.
|
|
184
167
|
"""
|
|
185
|
-
return self.web_client.
|
|
168
|
+
return self.web_client.grant_user_access(self.subject_openid, topic, user, "revoke")
|
|
186
169
|
|
|
187
170
|
@requires_login
|
|
188
|
-
def
|
|
171
|
+
def list_triggers(self):
|
|
189
172
|
"""
|
|
190
|
-
|
|
173
|
+
Retrieves the list of functions associated with the user's OpenID.
|
|
191
174
|
"""
|
|
192
|
-
return self.web_client.
|
|
175
|
+
return self.web_client.list_triggers(self.subject_openid)
|
|
193
176
|
|
|
194
177
|
@requires_login
|
|
195
|
-
def
|
|
178
|
+
def create_trigger(self, topic, function, function_configs):
|
|
196
179
|
"""
|
|
197
|
-
|
|
180
|
+
Registers a new functions under the user's OpenID.
|
|
198
181
|
"""
|
|
199
|
-
return self.web_client.
|
|
182
|
+
return self.web_client.create_trigger(self.subject_openid, topic, function, "create", function_configs)
|
|
200
183
|
|
|
201
184
|
@requires_login
|
|
202
|
-
def
|
|
185
|
+
def delete_trigger(self, topic, function):
|
|
203
186
|
"""
|
|
204
|
-
|
|
187
|
+
Unregisters a functions from the user's OpenID.
|
|
205
188
|
"""
|
|
206
|
-
return self.web_client.
|
|
189
|
+
return self.web_client.create_trigger(self.subject_openid, topic, function, "delete", {})
|
|
207
190
|
|
|
208
191
|
@requires_login
|
|
209
|
-
def
|
|
192
|
+
def update_trigger(self, trigger_uuid, trigger_configs):
|
|
210
193
|
"""
|
|
211
|
-
|
|
194
|
+
Update a functions's trigger'.
|
|
212
195
|
"""
|
|
213
|
-
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,104 +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
|
-
"/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def register_topic_for_user(
|
|
47
|
-
self, subject: UUID_LIKE_T, topic: str, user: UUID_LIKE_T
|
|
48
|
-
) -> globus_sdk.GlobusHTTPResponse:
|
|
49
|
-
return self.post(
|
|
50
|
-
"/v1/register_topic_for_user",
|
|
51
|
-
headers={"Subject": str(
|
|
52
|
-
subject), "Topic": topic, "User": str(user)}
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
def unregister_topic_for_user(
|
|
56
|
-
self, subject: UUID_LIKE_T, topic: str, user: UUID_LIKE_T
|
|
57
|
-
) -> globus_sdk.GlobusHTTPResponse:
|
|
58
|
-
return self.post(
|
|
59
|
-
"/v1/unregister_topic_for_user",
|
|
60
|
-
headers={"Subject": str(
|
|
61
|
-
subject), "Topic": topic, "User": str(user)}
|
|
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")
|
|
62
46
|
)
|
|
63
47
|
|
|
64
|
-
def
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def register_function(
|
|
68
|
-
self, subject: UUID_LIKE_T, topic: str, function: str,
|
|
69
|
-
function_configs: dict
|
|
48
|
+
def update_topic_configs(
|
|
49
|
+
self, subject: UUID_LIKE_T, topic: str, configs: dict
|
|
70
50
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
71
51
|
return self.post(
|
|
72
|
-
"/
|
|
52
|
+
f"/api/v2/topic/{topic}",
|
|
73
53
|
headers={"Subject": str(subject), "Topic": topic,
|
|
74
|
-
"
|
|
75
|
-
data=
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
def unregister_function(
|
|
79
|
-
self, subject: UUID_LIKE_T, topic: str, function: str
|
|
80
|
-
) -> globus_sdk.GlobusHTTPResponse:
|
|
81
|
-
return self.post(
|
|
82
|
-
"/v1/unregister_function", headers={"Subject": str(subject), "Topic": topic, "Function": function}
|
|
54
|
+
"Content-Type": "text/plain"},
|
|
55
|
+
data=json.dumps(configs).encode("utf-8")
|
|
83
56
|
)
|
|
84
57
|
|
|
85
|
-
def
|
|
86
|
-
self, subject: UUID_LIKE_T,
|
|
58
|
+
def update_topic_partitions(
|
|
59
|
+
self, subject: UUID_LIKE_T, topic: str, new_partitions: int
|
|
87
60
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
88
61
|
return self.post(
|
|
89
|
-
"/
|
|
90
|
-
headers={"Subject": str(subject), "
|
|
91
|
-
|
|
62
|
+
f"/api/v2/topic/{topic}/partitions",
|
|
63
|
+
headers={"Subject": str(subject), "Topic": topic,
|
|
64
|
+
"NewPartitions": str(new_partitions)},
|
|
92
65
|
)
|
|
93
66
|
|
|
94
|
-
def
|
|
95
|
-
self, subject: UUID_LIKE_T
|
|
67
|
+
def grant_user_access(
|
|
68
|
+
self, subject: UUID_LIKE_T, topic: str, user: UUID_LIKE_T, action: str
|
|
96
69
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
97
70
|
return self.post(
|
|
98
|
-
"/
|
|
99
|
-
headers={"Subject": str(subject)
|
|
71
|
+
f"/api/v2/topic/{topic}/user",
|
|
72
|
+
headers={"Subject": str(subject), "Action": action,
|
|
73
|
+
"Topic": topic, "User": str(user)}
|
|
100
74
|
)
|
|
101
75
|
|
|
102
|
-
def
|
|
103
|
-
self,
|
|
104
|
-
) -> globus_sdk.GlobusHTTPResponse:
|
|
105
|
-
return self.post(
|
|
106
|
-
"/v1/get_topic_configs",
|
|
107
|
-
headers={"Subject": str(subject), "Topic": topic},
|
|
108
|
-
data=configs
|
|
109
|
-
)
|
|
76
|
+
def list_triggers(self, subject: UUID_LIKE_T) -> globus_sdk.GlobusHTTPResponse:
|
|
77
|
+
return self.get("/api/v2/triggers", headers={"Subject": str(subject)})
|
|
110
78
|
|
|
111
|
-
def
|
|
112
|
-
self, subject: UUID_LIKE_T, topic: str,
|
|
79
|
+
def create_trigger(
|
|
80
|
+
self, subject: UUID_LIKE_T, topic: str, function: str, action: str,
|
|
81
|
+
function_configs: dict
|
|
113
82
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
114
|
-
return self.
|
|
115
|
-
"/
|
|
116
|
-
headers={"Subject": str(subject), "Topic": topic
|
|
117
|
-
|
|
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")
|
|
118
89
|
)
|
|
119
90
|
|
|
120
|
-
def
|
|
121
|
-
self, subject: UUID_LIKE_T,
|
|
91
|
+
def update_trigger(
|
|
92
|
+
self, subject: UUID_LIKE_T, trigger_uuid: UUID_LIKE_T, trigger_configs: dict
|
|
122
93
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
123
94
|
return self.post(
|
|
124
|
-
"/
|
|
125
|
-
headers={"Subject": str(subject), "
|
|
126
|
-
"
|
|
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")
|
|
127
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
|
|
File without changes
|