oscar-python 2.0.0__tar.gz → 2.1.0b1__tar.gz
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.
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/PKG-INFO +1 -1
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/client.py +28 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python.egg-info/PKG-INFO +1 -1
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_client.py +88 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/.github/workflows/release-build.yaml +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/.github/workflows/tests.yaml +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/.gitignore +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/LICENSE +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/README.md +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/jupyter_example/oscar_notebook.ipynb +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/jupyter_example/services/cowsay_example/cowsay.yaml +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/jupyter_example/services/cowsay_example/script.sh +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/__init__.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/_oidc.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/_providers/_minio.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/_providers/_onedata.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/_providers/_providers_base.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/_providers/_s3.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/_providers/_webdav.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/_utils.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/client_anon.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/default_client.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/local_test.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python/storage.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python.egg-info/SOURCES.txt +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python.egg-info/dependency_links.txt +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python.egg-info/requires.txt +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/oscar_python.egg-info/top_level.txt +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/pyproject.toml +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/setup.cfg +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/setup.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_default_client.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_oidc.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_onedata.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_s3.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_storage.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_utils.py +0 -0
- {oscar_python-2.0.0 → oscar_python-2.1.0b1}/tests/test_webdav.py +0 -0
|
@@ -33,6 +33,7 @@ _VOLUMES_PATH = "/system/volumes"
|
|
|
33
33
|
_BUCKETS_PATH = "/system/buckets"
|
|
34
34
|
_METRICS_PATH = "/system/metrics"
|
|
35
35
|
_QUOTAS_USER_PATH = "/system/quotas/user"
|
|
36
|
+
_FEDERATION_PATH = "/system/federation"
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
# _JOB_PATH = "/job"
|
|
@@ -340,3 +341,30 @@ class Client(DefaultClient):
|
|
|
340
341
|
def update_user_quota(self, user_id, cpu, memory):
|
|
341
342
|
data = json.dumps({"cpu": cpu, "memory": memory})
|
|
342
343
|
return utils.make_request(self, _QUOTAS_USER_PATH + "/" + user_id, _PUT, data=data)
|
|
344
|
+
|
|
345
|
+
""" Get federation members for a service """
|
|
346
|
+
def get_federation(self, service_name):
|
|
347
|
+
return utils.make_request(self, _FEDERATION_PATH + "/" + service_name, _GET)
|
|
348
|
+
|
|
349
|
+
""" Add federation members to a service """
|
|
350
|
+
def add_federation_members(self, service_name, members, clusters=None, storage_providers=None):
|
|
351
|
+
data = {"members": members}
|
|
352
|
+
if clusters:
|
|
353
|
+
data["clusters"] = clusters
|
|
354
|
+
if storage_providers:
|
|
355
|
+
data["storage_providers"] = storage_providers
|
|
356
|
+
return utils.make_request(self, _FEDERATION_PATH + "/" + service_name, _POST, data=json.dumps(data))
|
|
357
|
+
|
|
358
|
+
""" Update federation members of a service """
|
|
359
|
+
def update_federation_members(self, service_name, members, update, clusters=None, storage_providers=None):
|
|
360
|
+
data = {"members": members, "update": update}
|
|
361
|
+
if clusters:
|
|
362
|
+
data["clusters"] = clusters
|
|
363
|
+
if storage_providers:
|
|
364
|
+
data["storage_providers"] = storage_providers
|
|
365
|
+
return utils.make_request(self, _FEDERATION_PATH + "/" + service_name, _PUT, data=json.dumps(data))
|
|
366
|
+
|
|
367
|
+
""" Remove federation members from a service """
|
|
368
|
+
def remove_federation_members(self, service_name, members, delete=False):
|
|
369
|
+
data = {"members": members, "delete": delete}
|
|
370
|
+
return utils.make_request(self, _FEDERATION_PATH + "/" + service_name, _DELETE, data=json.dumps(data))
|
|
@@ -322,3 +322,91 @@ def test_update_user_quota(options):
|
|
|
322
322
|
client.update_user_quota("test_user", "2", "4Gi")
|
|
323
323
|
mock_request.assert_called_once_with(client, "/system/quotas/user/test_user", "put",
|
|
324
324
|
data=json.dumps({"cpu": "2", "memory": "4Gi"}))
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def test_get_federation(options):
|
|
328
|
+
client = Client(options)
|
|
329
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
330
|
+
client.get_federation("test_service")
|
|
331
|
+
mock_request.assert_called_once_with(client, "/system/federation/test_service", "get")
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def test_add_federation_members(options):
|
|
335
|
+
client = Client(options)
|
|
336
|
+
members = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 0}]
|
|
337
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
338
|
+
client.add_federation_members("test_service", members)
|
|
339
|
+
mock_request.assert_called_once_with(
|
|
340
|
+
client, "/system/federation/test_service", "post",
|
|
341
|
+
data=json.dumps({"members": members}))
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def test_add_federation_members_with_clusters(options):
|
|
345
|
+
client = Client(options)
|
|
346
|
+
members = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 0}]
|
|
347
|
+
clusters = {"c1": {"endpoint": "https://c1.com", "auth_user": "u", "auth_password": "p"}}
|
|
348
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
349
|
+
client.add_federation_members("test_service", members, clusters=clusters)
|
|
350
|
+
mock_request.assert_called_once_with(
|
|
351
|
+
client, "/system/federation/test_service", "post",
|
|
352
|
+
data=json.dumps({"members": members, "clusters": clusters}))
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def test_add_federation_members_with_storage_providers(options):
|
|
356
|
+
client = Client(options)
|
|
357
|
+
members = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 0}]
|
|
358
|
+
clusters = {"c1": {"endpoint": "https://c1.com", "auth_user": "u", "auth_password": "p"}}
|
|
359
|
+
storage_providers = {"minio": {"my-minio": {"endpoint": "https://minio.com", "access_key": "ak", "secret_key": "sk"}}}
|
|
360
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
361
|
+
client.add_federation_members("test_service", members, clusters=clusters,
|
|
362
|
+
storage_providers=storage_providers)
|
|
363
|
+
mock_request.assert_called_once_with(
|
|
364
|
+
client, "/system/federation/test_service", "post",
|
|
365
|
+
data=json.dumps({"members": members, "clusters": clusters,
|
|
366
|
+
"storage_providers": storage_providers}))
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def test_update_federation_members(options):
|
|
370
|
+
client = Client(options)
|
|
371
|
+
members = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 0}]
|
|
372
|
+
update = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 5}]
|
|
373
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
374
|
+
client.update_federation_members("test_service", members, update)
|
|
375
|
+
mock_request.assert_called_once_with(
|
|
376
|
+
client, "/system/federation/test_service", "put",
|
|
377
|
+
data=json.dumps({"members": members, "update": update}))
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def test_update_federation_members_with_clusters(options):
|
|
381
|
+
client = Client(options)
|
|
382
|
+
members = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 0}]
|
|
383
|
+
update = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 5}]
|
|
384
|
+
clusters = {"c1": {"endpoint": "https://c1.com", "auth_user": "u", "auth_password": "new"}}
|
|
385
|
+
storage_providers = {"minio": {"my-minio": {"endpoint": "https://minio.com", "access_key": "ak", "secret_key": "sk"}}}
|
|
386
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
387
|
+
client.update_federation_members("test_service", members, update,
|
|
388
|
+
clusters=clusters, storage_providers=storage_providers)
|
|
389
|
+
mock_request.assert_called_once_with(
|
|
390
|
+
client, "/system/federation/test_service", "put",
|
|
391
|
+
data=json.dumps({"members": members, "update": update,
|
|
392
|
+
"clusters": clusters, "storage_providers": storage_providers}))
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def test_remove_federation_members(options):
|
|
396
|
+
client = Client(options)
|
|
397
|
+
members = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 0}]
|
|
398
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
399
|
+
client.remove_federation_members("test_service", members)
|
|
400
|
+
mock_request.assert_called_once_with(
|
|
401
|
+
client, "/system/federation/test_service", "delete",
|
|
402
|
+
data=json.dumps({"members": members, "delete": False}))
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def test_remove_federation_members_with_delete(options):
|
|
406
|
+
client = Client(options)
|
|
407
|
+
members = [{"type": "oscar", "cluster_id": "c1", "service_name": "s1", "priority": 0}]
|
|
408
|
+
with patch('oscar_python._utils.make_request') as mock_request:
|
|
409
|
+
client.remove_federation_members("test_service", members, delete=True)
|
|
410
|
+
mock_request.assert_called_once_with(
|
|
411
|
+
client, "/system/federation/test_service", "delete",
|
|
412
|
+
data=json.dumps({"members": members, "delete": True}))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oscar_python-2.0.0 → oscar_python-2.1.0b1}/jupyter_example/services/cowsay_example/cowsay.yaml
RENAMED
|
File without changes
|
{oscar_python-2.0.0 → oscar_python-2.1.0b1}/jupyter_example/services/cowsay_example/script.sh
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|