[#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
36
src/FrostFS.SDK.Client/ApeRules/Resources.cs
Normal file
36
src/FrostFS.SDK.Client/ApeRules/Resources.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
namespace FrostFS.SDK.Client;
|
||||
|
||||
public struct Resource(bool inverted, string[] names) : System.IEquatable<Resource>
|
||||
{
|
||||
public bool Inverted { get; set; } = inverted;
|
||||
|
||||
public string[] Names { get; set; } = names;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || obj is not Resource)
|
||||
return false;
|
||||
|
||||
return Equals((Resource)obj);
|
||||
}
|
||||
|
||||
public override readonly int GetHashCode()
|
||||
{
|
||||
return Inverted.GetHashCode() ^ string.Join(string.Empty, Names).GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator ==(Resource left, Resource right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Resource left, Resource right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public readonly bool Equals(Resource other)
|
||||
{
|
||||
return this.GetHashCode().Equals(other.GetHashCode());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue