[#47] Add APE rule deserializer
Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
parent
db74919401
commit
39158348dd
21 changed files with 504 additions and 79 deletions
|
@ -1,13 +1,31 @@
|
|||
package info.frostfs.sdk.enums;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum ConditionKindType {
|
||||
RESOURCE(0),
|
||||
REQUEST(1),
|
||||
;
|
||||
|
||||
private static final Map<Integer, ConditionKindType> ENUM_MAP_BY_VALUE;
|
||||
|
||||
static {
|
||||
Map<Integer, ConditionKindType> map = new HashMap<>();
|
||||
for (ConditionKindType conditionKindType : ConditionKindType.values()) {
|
||||
map.put(conditionKindType.value, conditionKindType);
|
||||
}
|
||||
ENUM_MAP_BY_VALUE = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
public final int value;
|
||||
|
||||
ConditionKindType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ConditionKindType get(int value) {
|
||||
return ENUM_MAP_BY_VALUE.get(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package info.frostfs.sdk.enums;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum ConditionType {
|
||||
COND_STRING_EQUALS(0),
|
||||
COND_STRING_NOT_EQUALS(1),
|
||||
|
@ -28,9 +32,23 @@ public enum ConditionType {
|
|||
COND_NOT_IP_ADDRESS(18),
|
||||
;
|
||||
|
||||
private static final Map<Integer, ConditionType> ENUM_MAP_BY_VALUE;
|
||||
|
||||
static {
|
||||
Map<Integer, ConditionType> map = new HashMap<>();
|
||||
for (ConditionType conditionType : ConditionType.values()) {
|
||||
map.put(conditionType.value, conditionType);
|
||||
}
|
||||
ENUM_MAP_BY_VALUE = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
public final int value;
|
||||
|
||||
ConditionType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ConditionType get(int value) {
|
||||
return ENUM_MAP_BY_VALUE.get(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package info.frostfs.sdk.enums;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum RuleMatchType {
|
||||
// DENY_PRIORITY rejects the request if any `Deny` is specified.
|
||||
DENY_PRIORITY(0),
|
||||
|
@ -8,9 +12,23 @@ public enum RuleMatchType {
|
|||
FIRST_MATCH(1),
|
||||
;
|
||||
|
||||
private static final Map<Integer, RuleMatchType> ENUM_MAP_BY_VALUE;
|
||||
|
||||
static {
|
||||
Map<Integer, RuleMatchType> map = new HashMap<>();
|
||||
for (RuleMatchType ruleMatchType : RuleMatchType.values()) {
|
||||
map.put(ruleMatchType.value, ruleMatchType);
|
||||
}
|
||||
ENUM_MAP_BY_VALUE = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
public final int value;
|
||||
|
||||
RuleMatchType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static RuleMatchType get(int value) {
|
||||
return ENUM_MAP_BY_VALUE.get(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package info.frostfs.sdk.enums;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum RuleStatus {
|
||||
ALLOW(0),
|
||||
NO_RULE_FOUND(1),
|
||||
|
@ -7,9 +11,23 @@ public enum RuleStatus {
|
|||
QUOTA_LIMIT_REACHED(3),
|
||||
;
|
||||
|
||||
private static final Map<Integer, RuleStatus> ENUM_MAP_BY_VALUE;
|
||||
|
||||
static {
|
||||
Map<Integer, RuleStatus> map = new HashMap<>();
|
||||
for (RuleStatus ruleStatus : RuleStatus.values()) {
|
||||
map.put(ruleStatus.value, ruleStatus);
|
||||
}
|
||||
ENUM_MAP_BY_VALUE = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
public final int value;
|
||||
|
||||
RuleStatus(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static RuleStatus get(int value) {
|
||||
return ENUM_MAP_BY_VALUE.get(value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue