Example #1
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewRecrods.SelectedItems.Count == 1)
     {
         Amazon.Route53.Model.ResourceRecordSet set = (Amazon.Route53.Model.ResourceRecordSet)listViewRecrods.SelectedItems[0].Tag;
         DlgEditDnsRecord dlg = new DlgEditDnsRecord(MyController, set);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             Amazon.Route53.Model.ChangeResourceRecordSetsResponse resp =
                 MyController.route53.ChangeResourceRecordSets(new Amazon.Route53.Model.ChangeResourceRecordSetsRequest()
                                                               .WithHostedZoneId(this.MyZone.ResponseData.Id)
                                                               .WithChangeBatch(new Amazon.Route53.Model.ChangeBatch()
                                                                                .WithChanges(new Amazon.Route53.Model.Change()
                                                                                             .WithAction("DELETE")
                                                                                             .WithResourceRecordSet(set),
                                                                                             new Amazon.Route53.Model.Change()
                                                                                             .WithAction("CREATE")
                                                                                             .WithResourceRecordSet(new Amazon.Route53.Model.ResourceRecordSet()
                                                                                                                    .WithName(dlg.textBoxName.Text)
                                                                                                                    .WithType(dlg.comboBoxRecordType.Text)
                                                                                                                    .WithTTL(Convert.ToInt32(dlg.textBoxTTL.Text))
                                                                                                                    .WithResourceRecords(dlg.CurrentResourceRecords)))));
             Thread.Sleep(2000);
             MyZone.UpdateInfo();
             ShowItems();
         }
     }
 }
Example #2
0
        public void EditCnameRecord(string dnsName, string dnsValue)
        {
            var rrset = new Amazon.Route53.Model.ResourceRecordSet
            {
                TTL             = 30,
                Name            = dnsName,
                Type            = Amazon.Route53.RRType.CNAME,
                ResourceRecords = new List <Amazon.Route53.Model.ResourceRecord>
                {
                    new Amazon.Route53.Model.ResourceRecord(dnsValue)
                }
            };

            EditR53Record(rrset);
        }
        public void EditCnameRecord(string dnsName, string dnsValue)
        {
            var rrset = new Amazon.Route53.Model.ResourceRecordSet
            {
                TTL = 30,
                Name = dnsName,
                Type = Amazon.Route53.RRType.CNAME,
                ResourceRecords = new List<Amazon.Route53.Model.ResourceRecord>
                {
                    new Amazon.Route53.Model.ResourceRecord(dnsValue)
                }
            };

            EditR53Record(rrset);
        }
Example #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (listViewRecrods.SelectedItems.Count > 0 &&
         MessageBox.Show(string.Format("Are you sure you want to delete this record?"), "Confirm deletion",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2)
         == System.Windows.Forms.DialogResult.Yes)
     {
         foreach (ListViewItem item in listViewRecrods.SelectedItems)
         {
             Amazon.Route53.Model.ResourceRecordSet s = (Amazon.Route53.Model.ResourceRecordSet)item.Tag;
             MyZone.DeleteRecord(s);
         }
         ShowItems();
     }
 }
Example #5
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Amazon.Route53.Model.ResourceRecordSet set = new Amazon.Route53.Model.ResourceRecordSet();
            DlgEditDnsRecord dlg = new DlgEditDnsRecord(MyController, set);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                MyZone.AddRecord(new Amazon.Route53.Model.ResourceRecordSet()
                                 .WithName(dlg.textBoxName.Text)
                                 .WithType(dlg.comboBoxRecordType.Text)
                                 .WithTTL(Convert.ToInt32(dlg.textBoxTTL.Text))
                                 .WithResourceRecords(dlg.CurrentResourceRecords));
                ShowItems();
            }
        }
Example #6
0
        public void EditTxtRecord(string dnsName, IEnumerable <string> dnsValues)
        {
            var dnsValuesJoined = string.Join("\" \"", dnsValues);
            var rrset           = new Amazon.Route53.Model.ResourceRecordSet
            {
                TTL             = 30,
                Name            = dnsName,
                Type            = Amazon.Route53.RRType.TXT,
                ResourceRecords = new List <Amazon.Route53.Model.ResourceRecord>
                {
                    new Amazon.Route53.Model.ResourceRecord(
                        $"\"{dnsValuesJoined}\"")
                }
            };

            EditR53Record(rrset);
        }
        public void EditTxtRecord(string dnsName, IEnumerable<string> dnsValues)
        {
            var dnsValuesJoined = string.Join("\" \"", dnsValues);
            var rrset = new Amazon.Route53.Model.ResourceRecordSet
            {
                TTL = 30,
                Name = dnsName,
                Type = Amazon.Route53.RRType.TXT,
                ResourceRecords = new List<Amazon.Route53.Model.ResourceRecord>
                {
                    new Amazon.Route53.Model.ResourceRecord(
                            $"\"{dnsValuesJoined}\"")
                }
            };

            EditR53Record(rrset);
        }
Example #8
0
        private void EditR53Record(Amazon.Route53.Model.ResourceRecordSet rrset)
        {
            var r53 = new Amazon.Route53.AmazonRoute53Client(
                AccessKeyId, SecretAccessKey, RegionEndpoint);

            var rrRequ = new Amazon.Route53.Model.ChangeResourceRecordSetsRequest
            {
                HostedZoneId = HostedZoneId,
                ChangeBatch  = new Amazon.Route53.Model.ChangeBatch
                {
                    Changes = new List <Amazon.Route53.Model.Change>
                    {
                        new Amazon.Route53.Model.Change
                        {
                            Action            = Amazon.Route53.ChangeAction.UPSERT,
                            ResourceRecordSet = rrset
                        }
                    }
                }
            };
            var rrResp = r53.ChangeResourceRecordSets(rrRequ);
        }
Example #9
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     Amazon.Route53.Model.ResourceRecordSet set = new Amazon.Route53.Model.ResourceRecordSet();
     DlgEditDnsRecord dlg = new DlgEditDnsRecord(MyController, set);
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         MyZone.AddRecord(new Amazon.Route53.Model.ResourceRecordSet()
                                             .WithName(dlg.textBoxName.Text)
                                             .WithType(dlg.comboBoxRecordType.Text)
                                             .WithTTL(Convert.ToInt32(dlg.textBoxTTL.Text))
                                             .WithResourceRecords(dlg.CurrentResourceRecords));
         ShowItems();
     }
 }