Example #1
0
 public bool Equals(KubernetesObjectId other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(Namespace, other.Namespace) && string.Equals(Name, other.Name));
 }
Example #2
0
        public static bool TryParse(string value, out KubernetesObjectId id)
        {
            id = null;
            if (string.IsNullOrWhiteSpace(value))
            {
                return(false);
            }
            var split = value.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries).ToList();

            if (!split.Any())
            {
                return(false);
            }
            if (split.Count > 2)
            {
                return(false);
            }
            id = split.Count == 1
                ? new KubernetesObjectId(null, split.Single())
                : new KubernetesObjectId(split.First(), split.Last());

            return(true);
        }