Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

namespace Microsoft.Azure.Management.Dns.Testing
{
using System.Runtime.InteropServices;

public class ZoneScenarioTests
{
[Fact]
Expand All @@ -43,8 +45,9 @@ public void CrudZoneFullCycle()
{
Assert.Equal(zoneName, zone.Name);
Assert.False(string.IsNullOrEmpty(zone.ETag));
Assert.False(string.IsNullOrEmpty(zone.Properties.ParentResourceGroupName));
};

// Create the zone clean, verify response
ZoneCreateOrUpdateResponse createResponse = dnsClient.Zones.CreateOrUpdate(
resourceGroup.Name,
Expand All @@ -68,13 +71,17 @@ public void CrudZoneFullCycle()
Assert.Equal(HttpStatusCode.Created, createResponse.StatusCode);
assertZoneInvariants(createResponse.Zone);
Assert.Equal(1, createResponse.Zone.Tags.Count);
Assert.True(createResponse.Zone.Properties.NameServers != null && createResponse.Zone.Properties.NameServers.Any(nameServer => !string.IsNullOrWhiteSpace(nameServer)));
Assert.True(createResponse.Zone.Properties.ParentResourceGroupName == resourceGroup.Name);

// Retrieve the zone after create, verify response
var getresponse = dnsClient.Zones.Get(resourceGroup.Name, zoneName);

Assert.Equal(HttpStatusCode.OK, getresponse.StatusCode);
assertZoneInvariants(getresponse.Zone);
Assert.Equal(1, getresponse.Zone.Tags.Count);

Assert.True(getresponse.Zone.Properties.NameServers != null && getresponse.Zone.Properties.NameServers.Any(nameServer => !string.IsNullOrWhiteSpace(nameServer)));

// Call Update on the object returned by Create (important distinction from Get below)
Zone createdZone = createResponse.Zone;
Expand Down Expand Up @@ -127,7 +134,8 @@ public void ListZones()
Assert.Equal(2, listresponse.Zones.Count);
Assert.True(
listresponse.Zones.Any(zoneReturned => string.Equals(zoneNames[0], zoneReturned.Name))
&& listresponse.Zones.Any(zoneReturned => string.Equals(zoneNames[1], zoneReturned.Name)),
&& listresponse.Zones.Any(zoneReturned => string.Equals(zoneNames[1], zoneReturned.Name))
&& listresponse.Zones.All(zoneReturned => string.Equals(resourceGroup.Name, zoneReturned.Properties.ParentResourceGroupName)),
"The response of the List request does not meet expectations.");

ZoneScenarioTests.DeleteZones(dnsClient, resourceGroup, zoneNames);
Expand All @@ -142,16 +150,16 @@ public void ListZonesWithTopParameter()
context.Start();
DnsManagementClient dnsClient = ResourceGroupHelper.GetDnsClient();

var zoneNames = new[] { TestUtilities.GenerateName("hydratestdnszone") + ".com", TestUtilities.GenerateName("hydratestdnszone") + ".con" };
var zoneNames = new[] { TestUtilities.GenerateName("hydratestdnszone") + ".com", TestUtilities.GenerateName("hydratestdnszone") + ".com" };
ResourceGroupExtended resourceGroup = ResourceGroupHelper.CreateResourceGroup();
ZoneScenarioTests.CreateZones(dnsClient, resourceGroup, zoneNames);

ZoneListResponse listresponse = dnsClient.Zones.ListZonesInResourceGroup(resourceGroup.Name, new ZoneListParameters { Top = "1" });

Assert.NotNull(listresponse);
Assert.Equal(1, listresponse.Zones.Count);
Assert.True(listresponse.Zones.Any(zoneReturned => string.Equals(zoneNames[0], zoneReturned.Name)),
"The response of the List request does not meet expectations.");
Assert.True(zoneNames.Any(zoneName => zoneName == listresponse.Zones[0].Name), string.Format(" did not find zone name {0} in list ", listresponse.Zones[0].Name));
Assert.True(listresponse.Zones[0].Properties.ParentResourceGroupName == resourceGroup.Name, string.Format(" expected resource group name {0} is different from actual {1}", resourceGroup.Name, listresponse.Zones[0].Properties.ParentResourceGroupName));

ZoneScenarioTests.DeleteZones(dnsClient, resourceGroup, zoneNames);
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
// code is regenerated.

using System;
using System.Collections.Generic;
using System.Linq;
using Hyak.Common;

namespace Microsoft.Azure.Management.Dns.Models
{
Expand All @@ -41,6 +43,19 @@ public long? MaxNumberOfRecordSets
set { this._maxNumberOfRecordSets = value; }
}

private IList<string> _nameServers;

/// <summary>
/// Optional. Gets the name servers populated for this zone. This is a
/// read-only property and any attempt to set this value will be
/// ignored.
/// </summary>
public IList<string> NameServers
{
get { return this._nameServers; }
set { this._nameServers = value; }
}

private long? _numberOfRecordSets;

/// <summary>
Expand All @@ -53,11 +68,25 @@ public long? NumberOfRecordSets
set { this._numberOfRecordSets = value; }
}

private string _parentResourceGroupName;

/// <summary>
/// Optional. Gets the resource group name for this zone. THis is a
/// read-only property and any attempt to set this value will be
/// ignored.
/// </summary>
public string ParentResourceGroupName
{
get { return this._parentResourceGroupName; }
set { this._parentResourceGroupName = value; }
}

/// <summary>
/// Initializes a new instance of the ZoneProperties class.
/// </summary>
public ZoneProperties()
{
this.NameServers = new LazyList<string>();
}
}
}
133 changes: 133 additions & 0 deletions src/ResourceManagement/Dns/DnsManagement/Generated/ZoneOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
using System.Threading;
using System.Threading.Tasks;
using Hyak.Common;
using Hyak.Common.Internals;
using Microsoft.Azure;
using Microsoft.Azure.Management.Dns;
using Microsoft.Azure.Management.Dns.Models;
Expand Down Expand Up @@ -386,6 +387,24 @@ public async Task<ZoneCreateOrUpdateResponse> CreateOrUpdateAsync(string resourc
{
propertiesValue["numberOfRecordSets"] = parameters.Zone.Properties.NumberOfRecordSets.Value;
}

if (parameters.Zone.Properties.NameServers != null)
{
if (parameters.Zone.Properties.NameServers is ILazyCollection == false || ((ILazyCollection)parameters.Zone.Properties.NameServers).IsInitialized)
{
JArray nameServersArray = new JArray();
foreach (string nameServersItem in parameters.Zone.Properties.NameServers)
{
nameServersArray.Add(nameServersItem);
}
propertiesValue["nameServers"] = nameServersArray;
}
}

if (parameters.Zone.Properties.ParentResourceGroupName != null)
{
propertiesValue["parentResourceGroupName"] = parameters.Zone.Properties.ParentResourceGroupName;
}
}

if (parameters.Zone.Id != null)
Expand Down Expand Up @@ -492,6 +511,22 @@ public async Task<ZoneCreateOrUpdateResponse> CreateOrUpdateAsync(string resourc
long numberOfRecordSetsInstance = ((long)numberOfRecordSetsValue);
propertiesInstance.NumberOfRecordSets = numberOfRecordSetsInstance;
}

JToken nameServersArray2 = propertiesValue2["nameServers"];
if (nameServersArray2 != null && nameServersArray2.Type != JTokenType.Null)
{
foreach (JToken nameServersValue in ((JArray)nameServersArray2))
{
propertiesInstance.NameServers.Add(((string)nameServersValue));
}
}

JToken parentResourceGroupNameValue = propertiesValue2["parentResourceGroupName"];
if (parentResourceGroupNameValue != null && parentResourceGroupNameValue.Type != JTokenType.Null)
{
string parentResourceGroupNameInstance = ((string)parentResourceGroupNameValue);
propertiesInstance.ParentResourceGroupName = parentResourceGroupNameInstance;
}
}

JToken idValue = responseDoc["id"];
Expand Down Expand Up @@ -792,6 +827,22 @@ public async Task<ZoneGetResponse> GetAsync(string resourceGroupName, string zon
long numberOfRecordSetsInstance = ((long)numberOfRecordSetsValue);
propertiesInstance.NumberOfRecordSets = numberOfRecordSetsInstance;
}

JToken nameServersArray = propertiesValue["nameServers"];
if (nameServersArray != null && nameServersArray.Type != JTokenType.Null)
{
foreach (JToken nameServersValue in ((JArray)nameServersArray))
{
propertiesInstance.NameServers.Add(((string)nameServersValue));
}
}

JToken parentResourceGroupNameValue = propertiesValue["parentResourceGroupName"];
if (parentResourceGroupNameValue != null && parentResourceGroupNameValue.Type != JTokenType.Null)
{
string parentResourceGroupNameInstance = ((string)parentResourceGroupNameValue);
propertiesInstance.ParentResourceGroupName = parentResourceGroupNameInstance;
}
}

JToken idValue = responseDoc["id"];
Expand Down Expand Up @@ -991,6 +1042,22 @@ public async Task<ZoneListResponse> ListNextAsync(string nextLink, CancellationT
long numberOfRecordSetsInstance = ((long)numberOfRecordSetsValue);
propertiesInstance.NumberOfRecordSets = numberOfRecordSetsInstance;
}

JToken nameServersArray = propertiesValue["nameServers"];
if (nameServersArray != null && nameServersArray.Type != JTokenType.Null)
{
foreach (JToken nameServersValue in ((JArray)nameServersArray))
{
propertiesInstance.NameServers.Add(((string)nameServersValue));
}
}

JToken parentResourceGroupNameValue = propertiesValue["parentResourceGroupName"];
if (parentResourceGroupNameValue != null && parentResourceGroupNameValue.Type != JTokenType.Null)
{
string parentResourceGroupNameInstance = ((string)parentResourceGroupNameValue);
propertiesInstance.ParentResourceGroupName = parentResourceGroupNameInstance;
}
}

JToken idValue = valueValue["id"];
Expand Down Expand Up @@ -1242,6 +1309,22 @@ public async Task<ZoneListResponse> ListZonesInResourceGroupAsync(string resourc
long numberOfRecordSetsInstance = ((long)numberOfRecordSetsValue);
propertiesInstance.NumberOfRecordSets = numberOfRecordSetsInstance;
}

JToken nameServersArray = propertiesValue["nameServers"];
if (nameServersArray != null && nameServersArray.Type != JTokenType.Null)
{
foreach (JToken nameServersValue in ((JArray)nameServersArray))
{
propertiesInstance.NameServers.Add(((string)nameServersValue));
}
}

JToken parentResourceGroupNameValue = propertiesValue["parentResourceGroupName"];
if (parentResourceGroupNameValue != null && parentResourceGroupNameValue.Type != JTokenType.Null)
{
string parentResourceGroupNameInstance = ((string)parentResourceGroupNameValue);
propertiesInstance.ParentResourceGroupName = parentResourceGroupNameInstance;
}
}

JToken idValue = valueValue["id"];
Expand Down Expand Up @@ -1483,6 +1566,22 @@ public async Task<ZoneListResponse> ListZonesInSubscriptionAsync(ZoneListParamet
long numberOfRecordSetsInstance = ((long)numberOfRecordSetsValue);
propertiesInstance.NumberOfRecordSets = numberOfRecordSetsInstance;
}

JToken nameServersArray = propertiesValue["nameServers"];
if (nameServersArray != null && nameServersArray.Type != JTokenType.Null)
{
foreach (JToken nameServersValue in ((JArray)nameServersArray))
{
propertiesInstance.NameServers.Add(((string)nameServersValue));
}
}

JToken parentResourceGroupNameValue = propertiesValue["parentResourceGroupName"];
if (parentResourceGroupNameValue != null && parentResourceGroupNameValue.Type != JTokenType.Null)
{
string parentResourceGroupNameInstance = ((string)parentResourceGroupNameValue);
propertiesInstance.ParentResourceGroupName = parentResourceGroupNameInstance;
}
}

JToken idValue = valueValue["id"];
Expand Down Expand Up @@ -1702,6 +1801,24 @@ public async Task<ZoneUpdateResponse> UpdateAsync(string resourceGroupName, stri
{
propertiesValue["numberOfRecordSets"] = parameters.Zone.Properties.NumberOfRecordSets.Value;
}

if (parameters.Zone.Properties.NameServers != null)
{
if (parameters.Zone.Properties.NameServers is ILazyCollection == false || ((ILazyCollection)parameters.Zone.Properties.NameServers).IsInitialized)
{
JArray nameServersArray = new JArray();
foreach (string nameServersItem in parameters.Zone.Properties.NameServers)
{
nameServersArray.Add(nameServersItem);
}
propertiesValue["nameServers"] = nameServersArray;
}
}

if (parameters.Zone.Properties.ParentResourceGroupName != null)
{
propertiesValue["parentResourceGroupName"] = parameters.Zone.Properties.ParentResourceGroupName;
}
}

if (parameters.Zone.Id != null)
Expand Down Expand Up @@ -1808,6 +1925,22 @@ public async Task<ZoneUpdateResponse> UpdateAsync(string resourceGroupName, stri
long numberOfRecordSetsInstance = ((long)numberOfRecordSetsValue);
propertiesInstance.NumberOfRecordSets = numberOfRecordSetsInstance;
}

JToken nameServersArray2 = propertiesValue2["nameServers"];
if (nameServersArray2 != null && nameServersArray2.Type != JTokenType.Null)
{
foreach (JToken nameServersValue in ((JArray)nameServersArray2))
{
propertiesInstance.NameServers.Add(((string)nameServersValue));
}
}

JToken parentResourceGroupNameValue = propertiesValue2["parentResourceGroupName"];
if (parentResourceGroupNameValue != null && parentResourceGroupNameValue.Type != JTokenType.Null)
{
string parentResourceGroupNameInstance = ((string)parentResourceGroupNameValue);
propertiesInstance.ParentResourceGroupName = parentResourceGroupNameInstance;
}
}

JToken idValue = responseDoc["id"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Microsoft.Azure.Management.Dns
-->
<SdkNuGetPackage Include="Microsoft.Azure.Management.Dns">
<PackageVersion>1.5.0-preview</PackageVersion>
<PackageVersion>1.6.0-preview</PackageVersion>

<Folder>$(MSBuildThisFileDirectory)</Folder>
</SdkNuGetPackage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[assembly: AssemblyDescription("Provides management capabilities for DNS zones, record sets and records.")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
Expand Down