anuragp010 commented on code in PR #12213:
URL: https://github.com/apache/ozone/pull/12213#discussion_r4765764874
##########
hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java:
##########
@@ -106,35 +125,59 @@ protected void execute(OzoneClient client, OzoneAddress
address)
replicationConfig, chunkSize);
} else {
async(dataFile, bucket, keyName, keyMetadata,
- replicationConfig, chunkSize);
+ replicationConfig, chunkSize, storagePolicy);
+ }
+ }
+
+ /**
+ * Parse a user-supplied {@code --storage-policy} value into a {@link
StoragePolicy}. Returns {@code null} when the
+ * caller passed "null" (any case) or an empty value, so that the key
inherits the StoragePolicy of the bucket.
+ *
+ * @throws IllegalArgumentException if the value is not one of HOT, WARM,
COLD, or "null".
+ */
+ private static StoragePolicy parseStoragePolicy(String value) {
+ if (Strings.isNullOrEmpty(value) ||
NULL_STORAGE_POLICY.equalsIgnoreCase(value)) {
+ return null;
+ }
+ try {
+ return OzoneStoragePolicy.valueOf(value.toUpperCase());
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid storage policy: " + value
+ + ". Allowed String values are: HOT, WARM, COLD, or null.");
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]