public void StartTest()
        {
            string           zoneDirectory = @"C:\Users\oguzhan.O\Desktop\dns";
            MsDnsZoneParser  target        = new MsDnsZoneParser(zoneDirectory);
            List <MsDnsZone> actual        = target.Start();

            Assert.AreEqual(true, (actual.Count > 0));
        }
예제 #2
0
        static void Start()
        {
            var _parser = new MsDnsZoneParser(_zoneDirectory);
            var _api    = new ApiClient(_apiKey, _apiHost, _defaultPort, _defaultSSL, format: "XML", suppressResponse: true,
                                        suppressDnsZoneIP: true, generatePassword: false);

            var ZoneList = _parser.Start();

            foreach (var item in ZoneList)
            {
                ApiResult <DomainOperationsResult> createResult = null;

                if (_createDomain == "true")
                {
                    Console.WriteLine("Creating {0}", item.Name);
                    createResult = _api.DomainCreate(item.Name, _defaultPlan, item.Name, GetPassword(), false);
                    Console.WriteLine("\tResult: {0}", createResult.Message);
                }

                var records = item.Records
                              .Select(m => new DnsZoneRecordItem()
                {
                    name = m.Name, value = m.Value, type = m.RType.ToString(), priority = m.Priority
                })
                              .ToList();

                var serialNumber = Convert.ToInt32(DateTime.Now.ToString("yyyyMMddHH"));

                Console.WriteLine("Deploy Dns Zone {0}", item.Name);

                var dnsZoneResult = _api.SetDnsZone(item.Name,
                                                    item.Soa.ExpireLimit, item.Soa.MinimumTTL,
                                                    item.Soa.RefreshInterval, item.Soa.ResponsibleParty,
                                                    item.Soa.RetryDelay, serialNumber,
                                                    item.Soa.PrimaryServer, records);

                Console.WriteLine("\tResult: {0}", dnsZoneResult.Message);
            }
        }