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
|
@@ -0,0 +1,433 @@
|
|
|
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 jsonschema import ValidationError, validate
|
|
16
|
+
|
|
17
|
+
from rucio.common.exception import InvalidObject
|
|
18
|
+
|
|
19
|
+
ACCOUNT_LENGTH = 25
|
|
20
|
+
|
|
21
|
+
ACCOUNT = {"description": "Account name",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"maxLength": ACCOUNT_LENGTH,
|
|
24
|
+
"pattern": "^[a-z0-9-_]+$"}
|
|
25
|
+
|
|
26
|
+
ACCOUNTS = {"description": "Array of accounts",
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": ACCOUNT,
|
|
29
|
+
"minItems": 0,
|
|
30
|
+
"maxItems": 1000}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
ACCOUNT_TYPE = {"description": "Account type",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": ["USER", "GROUP", "SERVICE"]}
|
|
36
|
+
|
|
37
|
+
ACTIVITY = {"description": "Activity name",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"enum": ["Data Brokering", "Data Consolidation", "Data Rebalancing",
|
|
40
|
+
"Debug", "Express", "Functional Test", "Group Subscriptions",
|
|
41
|
+
"Production Input", "Production Output",
|
|
42
|
+
"Analysis Input", "Analysis Output", "Staging",
|
|
43
|
+
"T0 Export", "T0 Tape", "Upload/Download (Job)",
|
|
44
|
+
"Upload/Download (User)", "User Subscriptions", "Data Challenge"]}
|
|
45
|
+
|
|
46
|
+
SCOPE_LENGTH = 25
|
|
47
|
+
|
|
48
|
+
SCOPE = {"description": "Scope name",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"maxLength": SCOPE_LENGTH,
|
|
51
|
+
"pattern": "^[a-zA-Z_\\-.0-9]+$"}
|
|
52
|
+
|
|
53
|
+
R_SCOPE = {"description": "Scope name",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"pattern": "\\w"}
|
|
56
|
+
|
|
57
|
+
NAME_LENGTH = 250
|
|
58
|
+
|
|
59
|
+
NAME = {"description": "Data Identifier name",
|
|
60
|
+
"type": "string",
|
|
61
|
+
"maxLength": NAME_LENGTH,
|
|
62
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]*$"}
|
|
63
|
+
|
|
64
|
+
R_NAME = {"description": "Data Identifier name",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"pattern": "\\w"}
|
|
67
|
+
|
|
68
|
+
LOCKED = {"description": "Rule locked status",
|
|
69
|
+
"type": ["boolean", "null"]}
|
|
70
|
+
|
|
71
|
+
ASK_APPROVAL = {"description": "Rule approval request",
|
|
72
|
+
"type": ["boolean", "null"]}
|
|
73
|
+
|
|
74
|
+
ASYNCHRONOUS = {"description": "Asynchronous rule creation",
|
|
75
|
+
"type": ["boolean", "null"]}
|
|
76
|
+
|
|
77
|
+
DELAY_INJECTION = {"description": "Time (in seconds) to wait before starting applying the rule. Implies asynchronous rule creation.",
|
|
78
|
+
"type": ["integer", "null"]}
|
|
79
|
+
|
|
80
|
+
PURGE_REPLICAS = {"description": "Rule purge replica status",
|
|
81
|
+
"type": "boolean"}
|
|
82
|
+
|
|
83
|
+
IGNORE_AVAILABILITY = {"description": "Rule ignore availability status",
|
|
84
|
+
"type": "boolean"}
|
|
85
|
+
|
|
86
|
+
RSE = {"description": "RSE name",
|
|
87
|
+
"type": "string",
|
|
88
|
+
"pattern": "^([A-Z0-9]+([_-][A-Z0-9]+)*)$"}
|
|
89
|
+
|
|
90
|
+
RSE_ATTRIBUTE = {"description": "RSE attribute",
|
|
91
|
+
"type": "string",
|
|
92
|
+
"pattern": r'([A-Za-z0-9\._-]+[=<>][A-Za-z0-9_-]+)'}
|
|
93
|
+
|
|
94
|
+
DEFAULT_RSE_ATTRIBUTE = {"description": "Default RSE attribute",
|
|
95
|
+
"type": "string",
|
|
96
|
+
"pattern": r'([A-Z0-9]+([_-][A-Z0-9]+)*)'}
|
|
97
|
+
|
|
98
|
+
REPLICA_STATE = {"description": "Replica state",
|
|
99
|
+
"type": "string",
|
|
100
|
+
"enum": ["AVAILABLE", "UNAVAILABLE", "COPYING", "BEING_DELETED", "BAD", "SOURCE", "A", "U", "C", "B", "D", "S"]}
|
|
101
|
+
|
|
102
|
+
DATE = {"description": "Date",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"pattern": r'((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun))[,]\s\d{2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s(0\d|1\d|2[0-3])(\:)(0\d|1\d|2\d|3\d|4\d|5\d)(\:)(0\d|1\d|2\d|3\d|4\d|5\d)\s(UTC)'}
|
|
105
|
+
|
|
106
|
+
DID_TYPE = {"description": "DID type",
|
|
107
|
+
"type": "string",
|
|
108
|
+
"enum": ["DATASET", "CONTAINER", "FILE", "F"]}
|
|
109
|
+
|
|
110
|
+
GROUPING = {"description": "Rule grouping",
|
|
111
|
+
"type": ["string", "null"],
|
|
112
|
+
"enum": ["DATASET", "NONE", "ALL", None]}
|
|
113
|
+
|
|
114
|
+
NOTIFY = {"description": "Rule notification setting",
|
|
115
|
+
"type": ["string", "null"],
|
|
116
|
+
"enum": ["Y", "C", "N", "P", None]}
|
|
117
|
+
|
|
118
|
+
COMMENT = {"description": "Rule comment",
|
|
119
|
+
"type": ["string", "null"],
|
|
120
|
+
"maxLength": 250}
|
|
121
|
+
|
|
122
|
+
METADATA = {"description": "Rule wfms metadata",
|
|
123
|
+
"type": ["string", "null"],
|
|
124
|
+
"maxLength": 3999}
|
|
125
|
+
|
|
126
|
+
BYTES = {"description": "Size in bytes",
|
|
127
|
+
"type": "integer"}
|
|
128
|
+
|
|
129
|
+
ADLER32 = {"description": "adler32",
|
|
130
|
+
"type": "string",
|
|
131
|
+
"pattern": "^[a-fA-F\\d]{8}$"}
|
|
132
|
+
|
|
133
|
+
WEIGHT = {"description": "Rule weight",
|
|
134
|
+
"type": ["string", "null"]}
|
|
135
|
+
|
|
136
|
+
MD5 = {"description": "md5",
|
|
137
|
+
"type": "string",
|
|
138
|
+
"pattern": "^[a-fA-F\\d]{32}$"}
|
|
139
|
+
|
|
140
|
+
UUID = {"description": "Universally Unique Identifier (UUID)",
|
|
141
|
+
"type": "string",
|
|
142
|
+
"pattern": '^(\\{){0,1}[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}(\\}){0,1}$'}
|
|
143
|
+
|
|
144
|
+
META = {"description": "Data Identifier(DID) metadata",
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": {"guid": UUID},
|
|
147
|
+
"additionalProperties": True}
|
|
148
|
+
|
|
149
|
+
PFN = {"description": "Physical File Name", "type": "string"}
|
|
150
|
+
|
|
151
|
+
COPIES = {"description": "Number of replica copies", "type": "integer"}
|
|
152
|
+
|
|
153
|
+
RSE_EXPRESSION = {"description": "RSE expression", "type": "string"}
|
|
154
|
+
|
|
155
|
+
SOURCE_REPLICA_EXPRESSION = {"description": "RSE expression", "type": ["string", "null"]}
|
|
156
|
+
|
|
157
|
+
LIFETIME = {"description": "Lifetime", "type": "number"}
|
|
158
|
+
|
|
159
|
+
RULE_LIFETIME = {"description": "Rule lifetime", "type": ["number", "null"]}
|
|
160
|
+
|
|
161
|
+
SUBSCRIPTION_ID = {"description": "Rule Subscription id", "type": ["string", "null"]}
|
|
162
|
+
|
|
163
|
+
PRIORITY = {"description": "Priority of the transfers",
|
|
164
|
+
"type": "integer"}
|
|
165
|
+
|
|
166
|
+
SPLIT_CONTAINER = {"description": "Rule split container mode",
|
|
167
|
+
"type": ["boolean", "null"]}
|
|
168
|
+
|
|
169
|
+
TIME_ENTRY = {
|
|
170
|
+
"description": "Datetime, ISO 8601",
|
|
171
|
+
"type": "string",
|
|
172
|
+
"pattern": r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d*$'
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
IP = {
|
|
176
|
+
"description": "Internet Protocol address v4, RFC 791",
|
|
177
|
+
"type": "string",
|
|
178
|
+
"pattern": r'^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}$'
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
IPv4orIPv6 = {
|
|
182
|
+
"description": "IPv4 or IPv6 address",
|
|
183
|
+
"type": "string",
|
|
184
|
+
"format": "ipv4_or_ipv6"
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
CLIENT_STATE = {
|
|
188
|
+
"description": "Client state",
|
|
189
|
+
"type": "string",
|
|
190
|
+
"enum": ['DONE', 'FAILED', 'PROCESSING', 'ALREADY_DONE', 'FILE_NOT_FOUND', 'FOUND_IN_PCACHE', 'DOWNLOAD_ATTEMPT',
|
|
191
|
+
'FAIL_VALIDATE', 'FOUND_ROOT', 'ServiceUnavailable', 'SERVICE_ERROR', 'CP_TIMEOUT', 'COPY_ERROR',
|
|
192
|
+
'STAGEIN_ATTEMPT_FAILED', 'SourceNotFound', 'MISSINGOUTPUTFILE', 'MD_MISMATCH', 'CHECKSUMCALCULATIONFAILURE',
|
|
193
|
+
'MISSINGINPUT', 'MISSING_INPUT']
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
RULE = {"description": "Replication rule",
|
|
197
|
+
"type": "object",
|
|
198
|
+
"properties": {"dids": {"type": "array"},
|
|
199
|
+
"account": ACCOUNT,
|
|
200
|
+
"copies": COPIES,
|
|
201
|
+
"rse_expression": RSE_EXPRESSION,
|
|
202
|
+
"grouping": GROUPING,
|
|
203
|
+
"weight": WEIGHT,
|
|
204
|
+
"lifetime": RULE_LIFETIME,
|
|
205
|
+
"locked": LOCKED,
|
|
206
|
+
"subscription_id": SUBSCRIPTION_ID,
|
|
207
|
+
"source_replica_expression": SOURCE_REPLICA_EXPRESSION,
|
|
208
|
+
"activity": ACTIVITY,
|
|
209
|
+
"notify": NOTIFY,
|
|
210
|
+
"purge_replicas": PURGE_REPLICAS,
|
|
211
|
+
"ignore_availability": IGNORE_AVAILABILITY,
|
|
212
|
+
"comment": COMMENT,
|
|
213
|
+
"ask_approval": ASK_APPROVAL,
|
|
214
|
+
"asynchronous": ASYNCHRONOUS,
|
|
215
|
+
"delay_injection": DELAY_INJECTION,
|
|
216
|
+
"priority": PRIORITY,
|
|
217
|
+
'split_container': SPLIT_CONTAINER,
|
|
218
|
+
'meta': METADATA},
|
|
219
|
+
"required": ["dids", "copies", "rse_expression"],
|
|
220
|
+
"additionalProperties": False}
|
|
221
|
+
|
|
222
|
+
RULES = {"description": "Array of replication rules",
|
|
223
|
+
"type": "array",
|
|
224
|
+
"items": RULE,
|
|
225
|
+
"minItems": 1,
|
|
226
|
+
"maxItems": 1000}
|
|
227
|
+
|
|
228
|
+
COLLECTION_TYPE = {"description": "Dataset or container type",
|
|
229
|
+
"type": "string",
|
|
230
|
+
"enum": ["DATASET", "CONTAINER"]}
|
|
231
|
+
|
|
232
|
+
COLLECTION = {"description": "Dataset or container",
|
|
233
|
+
"type": "object",
|
|
234
|
+
"properties": {"scope": SCOPE,
|
|
235
|
+
"name": NAME,
|
|
236
|
+
"type": COLLECTION_TYPE,
|
|
237
|
+
"meta": META,
|
|
238
|
+
"rules": RULES},
|
|
239
|
+
"required": ["scope", "name", "type"],
|
|
240
|
+
"additionalProperties": False}
|
|
241
|
+
|
|
242
|
+
COLLECTIONS = {"description": "Array of datasets or containers",
|
|
243
|
+
"type": "array",
|
|
244
|
+
"items": COLLECTION,
|
|
245
|
+
"minItems": 1,
|
|
246
|
+
"maxItems": 1000}
|
|
247
|
+
|
|
248
|
+
DID = {"description": "Data Identifier(DID)",
|
|
249
|
+
"type": "object",
|
|
250
|
+
"properties": {"scope": SCOPE,
|
|
251
|
+
"name": NAME,
|
|
252
|
+
"type": DID_TYPE,
|
|
253
|
+
"meta": META,
|
|
254
|
+
"rules": RULES,
|
|
255
|
+
"bytes": BYTES,
|
|
256
|
+
"adler32": ADLER32,
|
|
257
|
+
"md5": MD5,
|
|
258
|
+
"state": REPLICA_STATE,
|
|
259
|
+
"pfn": PFN},
|
|
260
|
+
"required": ["scope", "name"],
|
|
261
|
+
"additionalProperties": False}
|
|
262
|
+
|
|
263
|
+
DID_FILTERS = {"description": "Array to filter DIDs by metadata",
|
|
264
|
+
"type": "array",
|
|
265
|
+
"additionalProperties": True}
|
|
266
|
+
|
|
267
|
+
R_DID = {"description": "Data Identifier(DID)",
|
|
268
|
+
"type": "object",
|
|
269
|
+
"properties": {"scope": R_SCOPE,
|
|
270
|
+
"name": R_NAME,
|
|
271
|
+
"type": DID_TYPE,
|
|
272
|
+
"meta": META,
|
|
273
|
+
"rules": RULES,
|
|
274
|
+
"bytes": BYTES,
|
|
275
|
+
"adler32": ADLER32,
|
|
276
|
+
"md5": MD5,
|
|
277
|
+
"state": REPLICA_STATE,
|
|
278
|
+
"pfn": PFN},
|
|
279
|
+
"required": ["scope", "name"],
|
|
280
|
+
"additionalProperties": False}
|
|
281
|
+
|
|
282
|
+
DIDS = {"description": "Array of Data Identifiers(DIDs)",
|
|
283
|
+
"type": "array",
|
|
284
|
+
"items": DID,
|
|
285
|
+
"minItems": 1,
|
|
286
|
+
"maxItems": 1000}
|
|
287
|
+
|
|
288
|
+
R_DIDS = {"description": "Array of Data Identifiers(DIDs)",
|
|
289
|
+
"type": "array",
|
|
290
|
+
"items": R_DID,
|
|
291
|
+
"minItems": 1,
|
|
292
|
+
"maxItems": 1000}
|
|
293
|
+
|
|
294
|
+
ATTACHMENT = {"description": "Attachment",
|
|
295
|
+
"type": "object",
|
|
296
|
+
"properties": {"scope": SCOPE,
|
|
297
|
+
"name": NAME,
|
|
298
|
+
"rse": {"description": "RSE name",
|
|
299
|
+
"type": ["string", "null"],
|
|
300
|
+
"pattern": "^([A-Z0-9]+([_-][A-Z0-9]+)*)$"},
|
|
301
|
+
"dids": DIDS},
|
|
302
|
+
"required": ["dids"],
|
|
303
|
+
"additionalProperties": False}
|
|
304
|
+
|
|
305
|
+
ATTACHMENTS = {"description": "Array of attachments",
|
|
306
|
+
"type": "array",
|
|
307
|
+
"items": ATTACHMENT,
|
|
308
|
+
"minItems": 1,
|
|
309
|
+
"maxItems": 1000}
|
|
310
|
+
|
|
311
|
+
SUBSCRIPTION_FILTER = {"type": "object",
|
|
312
|
+
"properties": {"datatype": {"type": "array"},
|
|
313
|
+
"prod_step": {"type": "array"},
|
|
314
|
+
"stream_name": {"type": "array"},
|
|
315
|
+
"project": {"type": "array"},
|
|
316
|
+
"scope": {"type": "array"},
|
|
317
|
+
"pattern": {"type": "string"},
|
|
318
|
+
"excluded_pattern": {"type": "string"},
|
|
319
|
+
"group": {"type": "string"},
|
|
320
|
+
"provenance": {"type": "string"},
|
|
321
|
+
"account": ACCOUNTS,
|
|
322
|
+
"grouping": {"type": "string"},
|
|
323
|
+
"split_rule": {"type": "boolean"}}}
|
|
324
|
+
|
|
325
|
+
ADD_REPLICA_FILE = {"description": "add replica file",
|
|
326
|
+
"type": "object",
|
|
327
|
+
"properties": {"scope": SCOPE,
|
|
328
|
+
"name": NAME,
|
|
329
|
+
"bytes": BYTES,
|
|
330
|
+
"adler32": ADLER32},
|
|
331
|
+
"required": ["scope", "name", "bytes", "adler32"]}
|
|
332
|
+
|
|
333
|
+
ADD_REPLICA_FILES = {"description": "add replica files",
|
|
334
|
+
"type": "array",
|
|
335
|
+
"items": ADD_REPLICA_FILE,
|
|
336
|
+
"minItems": 1,
|
|
337
|
+
"maxItems": 1000}
|
|
338
|
+
|
|
339
|
+
CACHE_ADD_REPLICAS = {"description": "rucio cache add replicas",
|
|
340
|
+
"type": "object",
|
|
341
|
+
"properties": {"files": ADD_REPLICA_FILES,
|
|
342
|
+
"rse": RSE,
|
|
343
|
+
"lifetime": LIFETIME,
|
|
344
|
+
"operation": {"enum": ["add_replicas"]}},
|
|
345
|
+
"required": ['files', 'rse', 'lifetime', 'operation']}
|
|
346
|
+
|
|
347
|
+
DELETE_REPLICA_FILE = {"description": "delete replica file",
|
|
348
|
+
"type": "object",
|
|
349
|
+
"properties": {"scope": SCOPE,
|
|
350
|
+
"name": NAME},
|
|
351
|
+
"required": ["scope", "name"]}
|
|
352
|
+
|
|
353
|
+
DELETE_REPLICA_FILES = {"description": "delete replica files",
|
|
354
|
+
"type": "array",
|
|
355
|
+
"items": DELETE_REPLICA_FILE,
|
|
356
|
+
"minItems": 1,
|
|
357
|
+
"maxItems": 1000}
|
|
358
|
+
|
|
359
|
+
CACHE_DELETE_REPLICAS = {"description": "rucio cache delete replicas",
|
|
360
|
+
"type": "object",
|
|
361
|
+
"properties": {"files": DELETE_REPLICA_FILES,
|
|
362
|
+
"rse": RSE,
|
|
363
|
+
"operation": {"enum": ["delete_replicas"]}},
|
|
364
|
+
"required": ['files', 'rse', 'operation']}
|
|
365
|
+
|
|
366
|
+
MESSAGE_OPERATION = {"type": "object",
|
|
367
|
+
"properties": {'operation': {"enum": ["add_replicas", "delete_replicas"]}}}
|
|
368
|
+
|
|
369
|
+
ACCOUNT_ATTRIBUTE = {"description": "Account attribute",
|
|
370
|
+
"type": "string",
|
|
371
|
+
"pattern": r'^[a-zA-Z0-9-_\\/\\.]{1,30}$'}
|
|
372
|
+
|
|
373
|
+
SCOPE_NAME_REGEXP = '/(.*)/(.*)'
|
|
374
|
+
|
|
375
|
+
DISTANCE = {"description": "RSE distance",
|
|
376
|
+
"type": "object",
|
|
377
|
+
"properties": {
|
|
378
|
+
"src_rse_id": {"type": "string"},
|
|
379
|
+
"dest_rse_id": {"type": "string"},
|
|
380
|
+
"ranking": {"type": "integer"}
|
|
381
|
+
},
|
|
382
|
+
"required": ["src_rse_id", "dest_rse_id", "ranking"],
|
|
383
|
+
"additionalProperties": True}
|
|
384
|
+
|
|
385
|
+
IMPORT = {"description": "import data into rucio.",
|
|
386
|
+
"type": "object",
|
|
387
|
+
"properties": {
|
|
388
|
+
"rses": {
|
|
389
|
+
"type": "object"
|
|
390
|
+
},
|
|
391
|
+
"distances": {
|
|
392
|
+
"type": "object"
|
|
393
|
+
}
|
|
394
|
+
}}
|
|
395
|
+
|
|
396
|
+
SCHEMAS = {'account': ACCOUNT,
|
|
397
|
+
'account_type': ACCOUNT_TYPE,
|
|
398
|
+
'activity': ACTIVITY,
|
|
399
|
+
'name': NAME,
|
|
400
|
+
'r_name': R_NAME,
|
|
401
|
+
'rse': RSE,
|
|
402
|
+
'rse_attribute': RSE_ATTRIBUTE,
|
|
403
|
+
'scope': SCOPE,
|
|
404
|
+
'r_scope': R_SCOPE,
|
|
405
|
+
'did': DID,
|
|
406
|
+
'did_filters': DID_FILTERS,
|
|
407
|
+
'r_did': R_DID,
|
|
408
|
+
'dids': DIDS,
|
|
409
|
+
'rule': RULE,
|
|
410
|
+
'r_dids': R_DIDS,
|
|
411
|
+
'collection': COLLECTION,
|
|
412
|
+
'collections': COLLECTIONS,
|
|
413
|
+
'attachment': ATTACHMENT,
|
|
414
|
+
'attachments': ATTACHMENTS,
|
|
415
|
+
'subscription_filter': SUBSCRIPTION_FILTER,
|
|
416
|
+
'cache_add_replicas': CACHE_ADD_REPLICAS,
|
|
417
|
+
'cache_delete_replicas': CACHE_DELETE_REPLICAS,
|
|
418
|
+
'account_attribute': ACCOUNT_ATTRIBUTE,
|
|
419
|
+
'import': IMPORT}
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
def validate_schema(name, obj):
|
|
423
|
+
"""
|
|
424
|
+
Validate object against json schema
|
|
425
|
+
|
|
426
|
+
:param name: The json schema name.
|
|
427
|
+
:param obj: The object to validate.
|
|
428
|
+
"""
|
|
429
|
+
try:
|
|
430
|
+
if obj:
|
|
431
|
+
validate(obj, SCHEMAS.get(name, {}))
|
|
432
|
+
except ValidationError as error: # NOQA, pylint: disable=W0612
|
|
433
|
+
raise InvalidObject(f'Problem validating {name}: {error}')
|