Skip to content

Commit

Permalink
dcache-rest namespace resource: add optional query parameter to retri…
Browse files Browse the repository at this point in the history
…eve a wealth of information about a file

Motivation:

Swagger API advertises a wealth of information about a file most
of which is inaccessible. We started ot get user complains about it.

Modification:

Add optional query parameter to namespace resource to retrieve all
the advertised information.

Result:

All ifnormation advertised by API can be retrieved

Target: trunk
Request: 8.2
  • Loading branch information
DmitryLitvintsev authored and mksahakyan committed Nov 3, 2022
1 parent f833169 commit 202ff9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Expand Up @@ -158,6 +158,9 @@ public JsonFileAttributes getFileAttributes(@ApiParam("Path of file or directory
@QueryParam("labels") boolean isLabels,
@ApiParam("Whether or not to list checksum values.")
@QueryParam("checksum") boolean isChecksum,
@ApiParam("Whether or not to print optional attributes")
@DefaultValue("false")
@QueryParam("optional") boolean isOptional,
@ApiParam("Limit number of replies in directory listing.")
@QueryParam("limit") String limit,
@ApiParam("Number of entries to skip in directory listing.")
Expand All @@ -168,7 +171,7 @@ public JsonFileAttributes getFileAttributes(@ApiParam("Path of file or directory
isLocations,
isQos,
isChecksum,
false);
isOptional);
PnfsHandler handler = HandlerBuilders.roleAwarePnfsHandler(pnfsmanager);
FsPath path = pathMapper.asDcachePath(request, requestPath, ForbiddenException::new);
try {
Expand All @@ -177,7 +180,7 @@ public JsonFileAttributes getFileAttributes(@ApiParam("Path of file or directory
NamespaceUtils.chimeraToJsonAttributes(path.name(), fileAttributes,
namespaceAttributes,
isLocality, isLocations, isLabels,
false, isXattr, isChecksum,
isOptional, isXattr, isChecksum,
request, poolMonitor);
if (isQos) {
NamespaceUtils.addQoSAttributes(fileAttributes,
Expand Down Expand Up @@ -220,7 +223,7 @@ public JsonFileAttributes getFileAttributes(@ApiParam("Path of file or directory
childrenAttributes,
entry.getFileAttributes(),
isLocality, isLocations, isLabels,
false, isXattr, isChecksum,
isOptional, isXattr, isChecksum,
request, poolMonitor);
childrenAttributes.setFileName(fName);
if (isQos) {
Expand Down
Expand Up @@ -275,7 +275,7 @@ public static Set<FileAttribute> getRequestedAttributes(boolean locality,
attributes.add(FileAttribute.RETENTION_POLICY);
}

if (checksum) {
if (checksum || optional) {
attributes.add(FileAttribute.CHECKSUM);
}

Expand Down

0 comments on commit 202ff9a

Please sign in to comment.