rucio-clients 32.8.6__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.

Potentially problematic release.


This version of rucio-clients might be problematic. Click here for more details.

Files changed (88) hide show
  1. rucio/__init__.py +18 -0
  2. rucio/alembicrevision.py +16 -0
  3. rucio/client/__init__.py +16 -0
  4. rucio/client/accountclient.py +413 -0
  5. rucio/client/accountlimitclient.py +155 -0
  6. rucio/client/baseclient.py +929 -0
  7. rucio/client/client.py +77 -0
  8. rucio/client/configclient.py +113 -0
  9. rucio/client/credentialclient.py +54 -0
  10. rucio/client/didclient.py +691 -0
  11. rucio/client/diracclient.py +48 -0
  12. rucio/client/downloadclient.py +1674 -0
  13. rucio/client/exportclient.py +44 -0
  14. rucio/client/fileclient.py +51 -0
  15. rucio/client/importclient.py +42 -0
  16. rucio/client/lifetimeclient.py +74 -0
  17. rucio/client/lockclient.py +99 -0
  18. rucio/client/metaclient.py +137 -0
  19. rucio/client/pingclient.py +45 -0
  20. rucio/client/replicaclient.py +444 -0
  21. rucio/client/requestclient.py +109 -0
  22. rucio/client/rseclient.py +664 -0
  23. rucio/client/ruleclient.py +287 -0
  24. rucio/client/scopeclient.py +88 -0
  25. rucio/client/subscriptionclient.py +161 -0
  26. rucio/client/touchclient.py +78 -0
  27. rucio/client/uploadclient.py +871 -0
  28. rucio/common/__init__.py +14 -0
  29. rucio/common/cache.py +74 -0
  30. rucio/common/config.py +796 -0
  31. rucio/common/constants.py +92 -0
  32. rucio/common/constraints.py +18 -0
  33. rucio/common/didtype.py +187 -0
  34. rucio/common/exception.py +1092 -0
  35. rucio/common/extra.py +37 -0
  36. rucio/common/logging.py +404 -0
  37. rucio/common/pcache.py +1387 -0
  38. rucio/common/policy.py +84 -0
  39. rucio/common/schema/__init__.py +143 -0
  40. rucio/common/schema/atlas.py +411 -0
  41. rucio/common/schema/belleii.py +406 -0
  42. rucio/common/schema/cms.py +478 -0
  43. rucio/common/schema/domatpc.py +399 -0
  44. rucio/common/schema/escape.py +424 -0
  45. rucio/common/schema/generic.py +431 -0
  46. rucio/common/schema/generic_multi_vo.py +410 -0
  47. rucio/common/schema/icecube.py +404 -0
  48. rucio/common/schema/lsst.py +423 -0
  49. rucio/common/stomp_utils.py +160 -0
  50. rucio/common/stopwatch.py +56 -0
  51. rucio/common/test_rucio_server.py +148 -0
  52. rucio/common/types.py +158 -0
  53. rucio/common/utils.py +1946 -0
  54. rucio/rse/__init__.py +97 -0
  55. rucio/rse/protocols/__init__.py +14 -0
  56. rucio/rse/protocols/cache.py +123 -0
  57. rucio/rse/protocols/dummy.py +112 -0
  58. rucio/rse/protocols/gfal.py +701 -0
  59. rucio/rse/protocols/globus.py +243 -0
  60. rucio/rse/protocols/gsiftp.py +93 -0
  61. rucio/rse/protocols/http_cache.py +83 -0
  62. rucio/rse/protocols/mock.py +124 -0
  63. rucio/rse/protocols/ngarc.py +210 -0
  64. rucio/rse/protocols/posix.py +251 -0
  65. rucio/rse/protocols/protocol.py +530 -0
  66. rucio/rse/protocols/rclone.py +365 -0
  67. rucio/rse/protocols/rfio.py +137 -0
  68. rucio/rse/protocols/srm.py +339 -0
  69. rucio/rse/protocols/ssh.py +414 -0
  70. rucio/rse/protocols/storm.py +207 -0
  71. rucio/rse/protocols/webdav.py +547 -0
  72. rucio/rse/protocols/xrootd.py +295 -0
  73. rucio/rse/rsemanager.py +752 -0
  74. rucio/vcsversion.py +11 -0
  75. rucio/version.py +46 -0
  76. rucio_clients-32.8.6.data/data/etc/rse-accounts.cfg.template +25 -0
  77. rucio_clients-32.8.6.data/data/etc/rucio.cfg.atlas.client.template +42 -0
  78. rucio_clients-32.8.6.data/data/etc/rucio.cfg.template +257 -0
  79. rucio_clients-32.8.6.data/data/requirements.txt +55 -0
  80. rucio_clients-32.8.6.data/data/rucio_client/merge_rucio_configs.py +147 -0
  81. rucio_clients-32.8.6.data/scripts/rucio +2540 -0
  82. rucio_clients-32.8.6.data/scripts/rucio-admin +2434 -0
  83. rucio_clients-32.8.6.dist-info/METADATA +50 -0
  84. rucio_clients-32.8.6.dist-info/RECORD +88 -0
  85. rucio_clients-32.8.6.dist-info/WHEEL +5 -0
  86. rucio_clients-32.8.6.dist-info/licenses/AUTHORS.rst +94 -0
  87. rucio_clients-32.8.6.dist-info/licenses/LICENSE +201 -0
  88. rucio_clients-32.8.6.dist-info/top_level.txt +1 -0
rucio/client/client.py ADDED
@@ -0,0 +1,77 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright European Organization for Nuclear Research (CERN) since 2012
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ """
17
+ Client class for callers of the Rucio system
18
+ """
19
+
20
+ from rucio.client.accountclient import AccountClient
21
+ from rucio.client.accountlimitclient import AccountLimitClient
22
+ from rucio.client.configclient import ConfigClient
23
+ from rucio.client.credentialclient import CredentialClient
24
+ from rucio.client.didclient import DIDClient
25
+ from rucio.client.diracclient import DiracClient
26
+ from rucio.client.exportclient import ExportClient
27
+ from rucio.client.importclient import ImportClient
28
+ from rucio.client.lifetimeclient import LifetimeClient
29
+ from rucio.client.lockclient import LockClient
30
+ from rucio.client.metaclient import MetaClient
31
+ from rucio.client.pingclient import PingClient
32
+ from rucio.client.replicaclient import ReplicaClient
33
+ from rucio.client.requestclient import RequestClient
34
+ from rucio.client.rseclient import RSEClient
35
+ from rucio.client.ruleclient import RuleClient
36
+ from rucio.client.scopeclient import ScopeClient
37
+ from rucio.client.subscriptionclient import SubscriptionClient
38
+ from rucio.client.touchclient import TouchClient
39
+
40
+
41
+ class Client(AccountClient,
42
+ AccountLimitClient,
43
+ MetaClient,
44
+ PingClient,
45
+ ReplicaClient,
46
+ RequestClient,
47
+ RSEClient,
48
+ ScopeClient,
49
+ DIDClient,
50
+ RuleClient,
51
+ SubscriptionClient,
52
+ LockClient,
53
+ ConfigClient,
54
+ TouchClient,
55
+ ImportClient,
56
+ ExportClient,
57
+ CredentialClient,
58
+ DiracClient,
59
+ LifetimeClient):
60
+
61
+ """Main client class for accessing Rucio resources. Handles the authentication."""
62
+
63
+ def __init__(self, **args):
64
+ """
65
+ Constructor for the Rucio main client class.
66
+
67
+ :param rucio_host: the host of the rucio system.
68
+ :param auth_host: the host of the rucio authentication server.
69
+ :param account: the rucio account that should be used to interact with the rucio system.
70
+ :param ca_cert: the certificate to verify the server.
71
+ :param auth_type: the type of authentication to use (e.g. userpass, x509 ...)
72
+ :param creds: credentials needed for authentication.
73
+ :param timeout: Float describes the timeout of the request (in seconds).
74
+ :param vo: The vo that the client will interact with.
75
+ :param logger: Logger instance to use (optional)
76
+ """
77
+ super(Client, self).__init__(**args)
@@ -0,0 +1,113 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright European Organization for Nuclear Research (CERN) since 2012
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from json import dumps
17
+
18
+ from requests.status_codes import codes
19
+
20
+ from rucio.client.baseclient import BaseClient
21
+ from rucio.client.baseclient import choice
22
+ from rucio.common.utils import build_url
23
+
24
+
25
+ class ConfigClient(BaseClient):
26
+
27
+ """Client class for working with the configuration"""
28
+
29
+ CONFIG_BASEURL = 'config'
30
+
31
+ def get_config(self, section=None, option=None):
32
+ """
33
+ Sends the request to get the matching configuration.
34
+
35
+ :param section: the optional name of the section.
36
+ :param option: the optional option within the section.
37
+ :return: dictionary containing the configuration.
38
+ """
39
+
40
+ if section is None and option is not None:
41
+ raise ValueError('--section not specified')
42
+
43
+ path = self.CONFIG_BASEURL
44
+ if section is not None and option is None:
45
+ path += '/' + section
46
+ elif section is not None and option is not None:
47
+ path += '/'.join(['', section, option])
48
+
49
+ url = build_url(choice(self.list_hosts), path=path)
50
+
51
+ r = self._send_request(url, type_='GET')
52
+ if r.status_code == codes.ok:
53
+ return r.json()
54
+ else:
55
+ exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
56
+ raise exc_cls(exc_msg)
57
+
58
+ def set_config_option(self, section, option, value, use_body_for_params=True):
59
+ """
60
+ Sends the request to create or set an option within a section. Missing sections will be created.
61
+
62
+ :param section: the name of the section.
63
+ :param option: the name of the option.
64
+ :param value: the value to set on the config option
65
+ :param use_body_for_params: send parameters in a json-encoded request body instead of url-encoded
66
+ TODO: remove this parameter
67
+ The format of the /config endpoint was recently changed. We migrated from performing a PUT on
68
+ "/config/<section>/<option>/<value>" to sending the parameters using a json-encoded body.
69
+ This was done to fix multiple un-wanted side effects related to how the middleware treats
70
+ values encoded in a path.
71
+ For a smooth transition, we allow both cases for now, but we should migrate to only passing
72
+ values via the request body.
73
+ :return: True if option was removed successfully. False otherwise.
74
+ """
75
+
76
+ if use_body_for_params:
77
+ url = build_url(choice(self.list_hosts), path=self.CONFIG_BASEURL)
78
+ data = dumps({
79
+ section: {
80
+ option: value
81
+ }
82
+ })
83
+ r = self._send_request(url, type_='POST', data=data)
84
+ else:
85
+ path = '/'.join([self.CONFIG_BASEURL, section, option, value])
86
+ url = build_url(choice(self.list_hosts), path=path)
87
+ r = self._send_request(url, type_='PUT')
88
+
89
+ if r.status_code == codes.created:
90
+ return True
91
+ else:
92
+ exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
93
+ raise exc_cls(exc_msg)
94
+
95
+ def delete_config_option(self, section, option):
96
+ """
97
+ Sends the request to remove an option from a section
98
+
99
+ :param section: the name of the section.
100
+ :param option: the name of the option.
101
+ :return: True if option was removed successfully. False otherwise.
102
+ """
103
+
104
+ path = '/'.join([self.CONFIG_BASEURL, section, option])
105
+ url = build_url(choice(self.list_hosts), path=path)
106
+
107
+ r = self._send_request(url, type_='DEL')
108
+
109
+ if r.status_code == codes.ok:
110
+ return True
111
+ else:
112
+ exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
113
+ raise exc_cls(exc_msg)
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright European Organization for Nuclear Research (CERN) since 2012
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from requests.status_codes import codes
17
+
18
+ from rucio.client.baseclient import BaseClient
19
+ from rucio.client.baseclient import choice
20
+ from rucio.common.utils import build_url
21
+
22
+
23
+ class CredentialClient(BaseClient):
24
+ """Credential client class for working with URL signing"""
25
+
26
+ CREDENTIAL_BASEURL = 'credentials'
27
+
28
+ def get_signed_url(self, rse, service, operation, url, lifetime=3600):
29
+ """
30
+ Return a signed version of the given URL for the given operation.
31
+
32
+ :param rse: The name of the RSE the URL points to.
33
+ :param service: The service the URL points to (gcs, s3, swift)
34
+ :param operation: The desired operation (read, write, delete)
35
+ :param url: The URL to sign
36
+ :param lifetime: The desired lifetime of the URL in seconds
37
+
38
+ :return: The signed URL string
39
+ """
40
+ path = '/'.join([self.CREDENTIAL_BASEURL, 'signurl'])
41
+ params = {}
42
+ params['lifetime'] = lifetime
43
+ params['rse'] = rse
44
+ params['svc'] = service
45
+ params['op'] = operation
46
+ params['url'] = url
47
+ rurl = build_url(choice(self.list_hosts), path=path, params=params)
48
+ r = self._send_request(rurl, type_='GET')
49
+
50
+ if r.status_code == codes.ok:
51
+ return r.text
52
+
53
+ exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
54
+ raise exc_cls(exc_msg)