Skip to content

Commit 5d46f6f

Browse files
committed
Merge pull request Azure#122 from t-alguer/ignite_dev
Adding warning when trailing dot + Adding the project to the ResourceManager
2 parents a1d0a42 + cb04ca4 commit 5d46f6f

File tree

9 files changed

+88
-9
lines changed

9 files changed

+88
-9
lines changed

src/ResourceManager.sln

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Websites.Test", "R
5555
EndProject
5656
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights.Test", "ResourceManager\Insights\Commands.Insights.Test\Commands.Insights.Test.csproj", "{469F20E0-9D40-41AD-94C3-B47AD15A4C00}"
5757
EndProject
58+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Dns", "ResourceManager\Dns\Commands.Dns\Commands.Dns.csproj", "{3CAE1B57-FFEC-4945-A6C5-6E5E8DEA4BA9}"
59+
EndProject
60+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Dns.Test", "ResourceManager\Dns\Commands.Dns.Test\Commands.Dns.Test.csproj", "{133561EC-99AF-4ADC-AF41-39C4D3AD323B}"
61+
EndProject
5862
Global
5963
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6064
Debug|Any CPU = Debug|Any CPU
@@ -149,6 +153,14 @@ Global
149153
{469F20E0-9D40-41AD-94C3-B47AD15A4C00}.Debug|Any CPU.Build.0 = Debug|Any CPU
150154
{469F20E0-9D40-41AD-94C3-B47AD15A4C00}.Release|Any CPU.ActiveCfg = Release|Any CPU
151155
{469F20E0-9D40-41AD-94C3-B47AD15A4C00}.Release|Any CPU.Build.0 = Release|Any CPU
156+
{3CAE1B57-FFEC-4945-A6C5-6E5E8DEA4BA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
157+
{3CAE1B57-FFEC-4945-A6C5-6E5E8DEA4BA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
158+
{3CAE1B57-FFEC-4945-A6C5-6E5E8DEA4BA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
159+
{3CAE1B57-FFEC-4945-A6C5-6E5E8DEA4BA9}.Release|Any CPU.Build.0 = Release|Any CPU
160+
{133561EC-99AF-4ADC-AF41-39C4D3AD323B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
161+
{133561EC-99AF-4ADC-AF41-39C4D3AD323B}.Debug|Any CPU.Build.0 = Debug|Any CPU
162+
{133561EC-99AF-4ADC-AF41-39C4D3AD323B}.Release|Any CPU.ActiveCfg = Release|Any CPU
163+
{133561EC-99AF-4ADC-AF41-39C4D3AD323B}.Release|Any CPU.Build.0 = Release|Any CPU
152164
EndGlobalSection
153165
GlobalSection(SolutionProperties) = preSolution
154166
HideSolutionNode = FALSE
@@ -162,7 +174,8 @@ Global
162174
{080B0477-7E52-4455-90AB-23BD13D1B1CE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
163175
{56ED8C97-53B9-4DF6-ACB5-7E6800105BF8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
164176
{7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
165-
{469F20E0-9D40-41AD-94C3-B47AD15A4C00} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
166177
{F4ABAD68-64A5-4B23-B09C-42559A7524DE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
178+
{469F20E0-9D40-41AD-94C3-B47AD15A4C00} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
179+
{133561EC-99AF-4ADC-AF41-39C4D3AD323B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
167180
EndGlobalSection
168181
EndGlobal

src/ResourceManager/Dns/Commands.Dns/Records/GetAzureDnsRescordSet.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ public override void ExecuteCmdlet()
6363

6464
if (this.ParameterSetName == "Fields")
6565
{
66+
if (this.ZoneName.EndsWith("."))
67+
{
68+
this.ZoneName = this.ZoneName.TrimEnd('.');
69+
this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'. Zone name used is \"{0}\".", this.ZoneName));
70+
}
71+
6672
zoneName = this.ZoneName;
6773
resourceGroupName = this.ResourceGroupName;
6874
}
@@ -79,6 +85,12 @@ public override void ExecuteCmdlet()
7985
throw new PSArgumentException("If you specify the Name parameter you must also specify the RecordType parameter.");
8086
}
8187

88+
if (this.Name.EndsWith("."))
89+
{
90+
this.Name = this.Name.TrimEnd('.');
91+
this.WriteWarning(string.Format("Modifying recordset name to remove terminating '.'. Recordset name used is \"{0}\".", this.Name));
92+
}
93+
8294
DnsRecordSet result = this.DnsClient.GetDnsRecordSet(this.Name, zoneName, resourceGroupName, recordType);
8395
this.WriteObject(result);
8496
}

src/ResourceManager/Dns/Commands.Dns/Records/NewAzureDnsRescordSet.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ public override void ExecuteCmdlet()
6969

7070
if (ParameterSetName == "Fields")
7171
{
72+
if (this.ZoneName.EndsWith("."))
73+
{
74+
this.ZoneName = this.ZoneName.TrimEnd('.');
75+
this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'. Zone name used is \"{0}\".", this.ZoneName));
76+
}
77+
7278
zoneName = this.ZoneName;
7379
resourceGroupname = this.ResourceGroupName;
7480
}
@@ -78,6 +84,12 @@ public override void ExecuteCmdlet()
7884
resourceGroupname = this.Zone.ResourceGroupName;
7985
}
8086

87+
if (this.Name.EndsWith("."))
88+
{
89+
this.Name = this.Name.TrimEnd('.');
90+
this.WriteWarning(string.Format("Modifying recordset name to remove terminating '.'. Recordset name used is \"{0}\".", this.Name));
91+
}
92+
8193
ConfirmAction(
8294
!Overwrite.IsPresent || Force.IsPresent,
8395
string.Format(ProjectResources.Confirm_OverwriteRecord, this.Name, this.RecordType, zoneName),

src/ResourceManager/Dns/Commands.Dns/Records/RemoveAzureDnsRecordSet.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ public override void ExecuteCmdlet()
6969

7070
if (this.ParameterSetName == "Fields")
7171
{
72+
if (this.Name.EndsWith("."))
73+
{
74+
this.Name = this.Name.TrimEnd('.');
75+
this.WriteWarning(string.Format("Modifying recordset name to remove terminating '.'. Recordset name used is \"{0}\".", this.Name));
76+
}
77+
78+
if (this.ZoneName.EndsWith("."))
79+
{
80+
this.ZoneName = this.ZoneName.TrimEnd('.');
81+
this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'. Zone name used is \"{0}\".", this.ZoneName));
82+
}
83+
7284
recordSetToDelete = new DnsRecordSet
7385
{
7486
Name = this.Name,
@@ -80,6 +92,12 @@ public override void ExecuteCmdlet()
8092
}
8193
else if (this.ParameterSetName == "Mixed")
8294
{
95+
if (this.Name.EndsWith("."))
96+
{
97+
this.Name = this.Name.TrimEnd('.');
98+
this.WriteWarning(string.Format("Modifying recordset name to remove terminating '.'. Recordset name used is \"{0}\".", this.Name));
99+
}
100+
83101
recordSetToDelete = new DnsRecordSet
84102
{
85103
Name = this.Name,

src/ResourceManager/Dns/Commands.Dns/Zones/GetAzureDnsZone.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ public override void ExecuteCmdlet()
3636
{
3737
if (this.Name != null)
3838
{
39-
WriteObject(this.DnsClient.GetDnsZone(this.Name, this.ResourceGroupName));
39+
if (this.Name.EndsWith("."))
40+
{
41+
this.Name = this.Name.TrimEnd('.');
42+
this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'. Zone name used is \"{0}\".", this.Name));
43+
}
44+
45+
this.WriteObject(this.DnsClient.GetDnsZone(this.Name, this.ResourceGroupName));
4046
}
4147
else
4248
{
43-
WriteObject(this.DnsClient.ListDnsZones(this.ResourceGroupName));
49+
this.WriteObject(this.DnsClient.ListDnsZones(this.ResourceGroupName));
4450
}
4551
}
4652
}

src/ResourceManager/Dns/Commands.Dns/Zones/NewAzureDnsZone.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ public class NewAzureDnsZone : DnsBaseCmdlet
4040

4141
public override void ExecuteCmdlet()
4242
{
43+
if (this.Name.EndsWith("."))
44+
{
45+
this.Name = this.Name.TrimEnd('.');
46+
this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'. Zone name used is \"{0}\".", this.Name));
47+
}
48+
4349
DnsZone result = this.DnsClient.CreateDnsZone(this.Name, this.ResourceGroupName, this.Tag);
44-
WriteVerbose(ProjectResources.Success);
45-
WriteVerbose(string.Format(ProjectResources.Success_NewZone, this.Name, this.ResourceGroupName));
46-
WriteObject(result);
50+
this.WriteVerbose(ProjectResources.Success);
51+
this.WriteVerbose(string.Format(ProjectResources.Success_NewZone, this.Name, this.ResourceGroupName));
52+
this.WriteObject(result);
4753
}
4854
}
4955
}

src/ResourceManager/Dns/Commands.Dns/Zones/RemoveAzureDnsZone.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public override void ExecuteCmdlet()
5555

5656
if (this.ParameterSetName == "Fields")
5757
{
58+
if (this.Name.EndsWith("."))
59+
{
60+
this.Name = this.Name.TrimEnd('.');
61+
this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'. Zone name used is \"{0}\".", this.Name));
62+
}
63+
5864
zoneToDelete = new DnsZone
5965
{
6066
Name = this.Name,
@@ -64,12 +70,12 @@ public override void ExecuteCmdlet()
6470
}
6571
else if (this.ParameterSetName == "Object")
6672
{
67-
zoneToDelete = this.Zone;
68-
6973
if ((string.IsNullOrWhiteSpace(this.Zone.Etag) || this.Zone.Etag == "*") && !this.IgnoreEtag.IsPresent)
7074
{
7175
throw new PSArgumentException(string.Format(ProjectResources.Error_EtagNotSpecified, typeof(DnsZone).Name));
7276
}
77+
78+
zoneToDelete = this.Zone;
7379
}
7480

7581
bool ignoreEtag = this.IgnoreEtag.IsPresent || this.ParameterSetName != "Object";

src/ResourceManager/Dns/Commands.Dns/Zones/SetAzureDnsZone.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public override void ExecuteCmdlet()
5252

5353
if (this.ParameterSetName == "Fields")
5454
{
55+
if (this.Name.EndsWith("."))
56+
{
57+
this.Name = this.Name.TrimEnd('.');
58+
this.WriteWarning(string.Format("Modifying zone name to remove terminating '.'. Zone name used is \"{0}\".", this.Name));
59+
}
60+
5561
zoneToUpdate = new DnsZone
5662
{
5763
Name = this.Name,

src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ NestedModules = @(
7777
'.\DataFactories\Microsoft.Azure.Commands.DataFactories.dll',
7878
'.\RedisCache\Microsoft.Azure.Commands.RedisCache.dll',
7979
'.\Batch\Microsoft.Azure.Commands.Batch.dll',
80-
'.\Dns\Microsoft.Azure.Commands.Dns.dll'
80+
'.\Dns\Microsoft.Azure.Commands.Dns.dll',
8181
'.\KeyVault\Microsoft.Azure.Commands.KeyVault.dll',
8282
'.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.dll',
8383
'.\Insights\Microsoft.Azure.Commands.Insights.dll',

0 commit comments

Comments
 (0)