HDDS-808. Simplify OMAction and DNAction classes used for AuditLogging. Contributed by Dinesh Chitlangia.

This commit is contained in:
Ajay Kumar 2018-11-29 08:35:02 -08:00
parent 07142f54a8
commit 184cced513
3 changed files with 58 additions and 76 deletions

View File

@ -21,34 +21,28 @@ package org.apache.hadoop.ozone.audit;
*/
public enum DNAction implements AuditAction {
CREATE_CONTAINER("CREATE_CONTAINER"),
READ_CONTAINER("READ_CONTAINER"),
UPDATE_CONTAINER("UPDATE_CONTAINER"),
DELETE_CONTAINER("DELETE_CONTAINER"),
LIST_CONTAINER("LIST_CONTAINER"),
PUT_BLOCK("PUT_BLOCK"),
GET_BLOCK("GET_BLOCK"),
DELETE_BLOCK("DELETE_BLOCK"),
LIST_BLOCK("LIST_BLOCK"),
READ_CHUNK("READ_CHUNK"),
DELETE_CHUNK("DELETE_CHUNK"),
WRITE_CHUNK("WRITE_CHUNK"),
LIST_CHUNK("LIST_CHUNK"),
COMPACT_CHUNK("COMPACT_CHUNK"),
PUT_SMALL_FILE("PUT_SMALL_FILE"),
GET_SMALL_FILE("GET_SMALL_FILE"),
CLOSE_CONTAINER("CLOSE_CONTAINER"),
GET_COMMITTED_BLOCK_LENGTH("GET_COMMITTED_BLOCK_LENGTH");
private String action;
DNAction(String action) {
this.action = action;
}
CREATE_CONTAINER,
READ_CONTAINER,
UPDATE_CONTAINER,
DELETE_CONTAINER,
LIST_CONTAINER,
PUT_BLOCK,
GET_BLOCK,
DELETE_BLOCK,
LIST_BLOCK,
READ_CHUNK,
DELETE_CHUNK,
WRITE_CHUNK,
LIST_CHUNK,
COMPACT_CHUNK,
PUT_SMALL_FILE,
GET_SMALL_FILE,
CLOSE_CONTAINER,
GET_COMMITTED_BLOCK_LENGTH;
@Override
public String getAction() {
return this.action;
return this.toString();
}
}

View File

@ -22,30 +22,24 @@ package org.apache.hadoop.ozone.audit;
*/
public enum DummyAction implements AuditAction {
CREATE_VOLUME("CREATE_VOLUME"),
CREATE_BUCKET("CREATE_BUCKET"),
CREATE_KEY("CREATE_KEY"),
READ_VOLUME("READ_VOLUME"),
READ_BUCKET("READ_BUCKET"),
READ_KEY("READ_BUCKET"),
UPDATE_VOLUME("UPDATE_VOLUME"),
UPDATE_BUCKET("UPDATE_BUCKET"),
UPDATE_KEY("UPDATE_KEY"),
DELETE_VOLUME("DELETE_VOLUME"),
DELETE_BUCKET("DELETE_BUCKET"),
DELETE_KEY("DELETE_KEY"),
SET_OWNER("SET_OWNER"),
SET_QUOTA("SET_QUOTA");
private final String action;
DummyAction(String action) {
this.action = action;
}
CREATE_VOLUME,
CREATE_BUCKET,
CREATE_KEY,
READ_VOLUME,
READ_BUCKET,
READ_KEY,
UPDATE_VOLUME,
UPDATE_BUCKET,
UPDATE_KEY,
DELETE_VOLUME,
DELETE_BUCKET,
DELETE_KEY,
SET_OWNER,
SET_QUOTA;
@Override
public String getAction() {
return this.action;
return this.toString();
}
}

View File

@ -23,40 +23,34 @@ package org.apache.hadoop.ozone.audit;
public enum OMAction implements AuditAction {
// WRITE Actions
ALLOCATE_BLOCK("ALLOCATE_BLOCK"),
ALLOCATE_KEY("ALLOCATE_KEY"),
COMMIT_KEY("COMMIT_KEY"),
CREATE_VOLUME("CREATE_VOLUME"),
CREATE_BUCKET("CREATE_BUCKET"),
CREATE_KEY("CREATE_KEY"),
DELETE_VOLUME("DELETE_VOLUME"),
DELETE_BUCKET("DELETE_BUCKET"),
DELETE_KEY("DELETE_KEY"),
RENAME_KEY("RENAME_KEY"),
SET_OWNER("SET_OWNER"),
SET_QUOTA("SET_QUOTA"),
UPDATE_VOLUME("UPDATE_VOLUME"),
UPDATE_BUCKET("UPDATE_BUCKET"),
UPDATE_KEY("UPDATE_KEY"),
ALLOCATE_BLOCK,
ALLOCATE_KEY,
COMMIT_KEY,
CREATE_VOLUME,
CREATE_BUCKET,
CREATE_KEY,
DELETE_VOLUME,
DELETE_BUCKET,
DELETE_KEY,
RENAME_KEY,
SET_OWNER,
SET_QUOTA,
UPDATE_VOLUME,
UPDATE_BUCKET,
UPDATE_KEY,
// READ Actions
CHECK_VOLUME_ACCESS("CHECK_VOLUME_ACCESS"),
LIST_BUCKETS("LIST_BUCKETS"),
LIST_VOLUMES("LIST_VOLUMES"),
LIST_KEYS("LIST_KEYS"),
READ_VOLUME("READ_VOLUME"),
READ_BUCKET("READ_BUCKET"),
READ_KEY("READ_BUCKET"),
LIST_S3BUCKETS("LIST_S3BUCKETS");
private String action;
OMAction(String action) {
this.action = action;
}
CHECK_VOLUME_ACCESS,
LIST_BUCKETS,
LIST_VOLUMES,
LIST_KEYS,
READ_VOLUME,
READ_BUCKET,
READ_KEY,
LIST_S3BUCKETS;
@Override
public String getAction() {
return this.action;
return this.toString();
}
}