Forum Discussion
Adding and Deleting data group records and ZoneRunner records via PowerShell
I figured it out! Code below:
Interfaces interfaces = new Interfaces();
string[] view = { "external" };
ManagementViewInfo[] views = interfaces.ManagementView.get_list();
ManagementViewZone[] viewZones = interfaces.ManagementZone.get_zone_name(view);
ManagementZoneInfo[] zoneInfo = interfaces.ManagementZone.get_zone(viewZones);
ManagementCNAMERecord record = new ManagementCNAMERecord();
record.cname = "test";
record.domain_name = "st.int";
record.ttl = 3600;
ManagementCNAMERecord[][] recordseqseq = new ManagementCNAMERecord[][]
{
new ManagementCNAMERecord[] {record}
};
try
{
interfaces.ManagementResourceRecord.add_cname(viewZones, recordseqseq);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}Now in all reality, this code will NOT work as it is because you need to have FQDNs for both the cname and the domain_name field. Funny thing also is that the catch does not catch the error... It does catch exceptions on some configurations but if you have a domain name only and a cname only, it will not catch the exception.
I am creating a custom REST API to automate some of the tasks that need to be done so I should be able to take care of error handling via Model Validation.
Thanks for all the help!
Tony
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com