Esempio n. 1
0
        public void Add(AddNodesEntity entity, ClaimsPrincipal user)
        {
            if (!dnsValidation.ValidateDnsName(entity.Hostname))
            {
                throw new Exception("Invalid hostname provided");
            }


            if (string.IsNullOrWhiteSpace(entity.CredentialId))
            {
                throw new Exception("Credential requested does not exist");
            }


            if (!adIdpLogic.AdIdpExists(entity.CredentialId))
            {
                throw new Exception("Credential requested does not exist");
            }

            Node node = new Node()
            {
                Hostname          = entity.Hostname,
                Id                = Guid.NewGuid(),
                DiscoveryType     = Entities.Enumerations.DiscoveryType.Manual,
                LastCommunication = DateTime.MinValue,
                CredentialId      = Guid.Parse(entity.CredentialId)
            };

            configurationRepository.Insert <Node>(node);
        }
Esempio n. 2
0
 public JsonResult AddNode(AddNodesEntity node)
 {
     nodeLogic.Add(node, User);
     return(http.RespondSuccess());
 }