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