[#30] Client: Add object model for Rules
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
43e300c773
commit
195854a45b
27 changed files with 677 additions and 155 deletions
43
src/FrostFS.SDK.Client/ApeRules/Condition.cs
Normal file
43
src/FrostFS.SDK.Client/ApeRules/Condition.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
namespace FrostFS.SDK.Client;
|
||||
|
||||
public struct Condition : System.IEquatable<Condition>
|
||||
{
|
||||
public ConditionType Op { get; set; }
|
||||
|
||||
public ConditionKindType Kind { get; set; }
|
||||
|
||||
public string? Key { get; set; }
|
||||
|
||||
public string? Value { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || obj is not Condition)
|
||||
return false;
|
||||
|
||||
return Equals((Condition)obj);
|
||||
}
|
||||
|
||||
public override readonly int GetHashCode()
|
||||
{
|
||||
return Op.GetHashCode()
|
||||
^ Kind.GetHashCode()
|
||||
^ (Key != null ? Key.GetHashCode() : 0)
|
||||
^ (Value != null ? Value.GetHashCode() : 0);
|
||||
}
|
||||
|
||||
public static bool operator ==(Condition left, Condition right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Condition left, Condition right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public readonly bool Equals(Condition other)
|
||||
{
|
||||
return this.GetHashCode().Equals(other.GetHashCode());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue