diff --git a/src/AzureNamingTool.csproj b/src/AzureNamingTool.csproj index bfea44f..eafe464 100644 --- a/src/AzureNamingTool.csproj +++ b/src/AzureNamingTool.csproj @@ -1,7 +1,7 @@  - 3.1.0 + 3.1.1 net7.0 enable enable diff --git a/src/Models/ValidateNameRequest.cs b/src/Models/ValidateNameRequest.cs index a83582f..ff760ee 100644 --- a/src/Models/ValidateNameRequest.cs +++ b/src/Models/ValidateNameRequest.cs @@ -2,6 +2,7 @@ { public class ValidateNameRequest { + public long? ResourceTypeId { get; set;} public string? ResourceType { get; set; } public string? Name { get; set; } } diff --git a/src/Services/ResourceNamingRequestService.cs b/src/Services/ResourceNamingRequestService.cs index 109e534..9f820e8 100644 --- a/src/Services/ResourceNamingRequestService.cs +++ b/src/Services/ResourceNamingRequestService.cs @@ -172,6 +172,7 @@ public static async Task RequestNameWithComponents(Resourc // CALL VALIDATION FUNCTION ValidateNameRequest validateNameRequest = new() { + ResourceTypeId = resourceType.Id, ResourceType = resourceType.ShortName, Name = name }; @@ -706,6 +707,7 @@ public static async Task RequestName(ResourceNameRequest r // Validate the generated name for the resource type ValidateNameRequest validateNameRequest = new() { + ResourceTypeId = resourceType.Id, ResourceType = resourceType.ShortName, Name = name }; diff --git a/src/Services/ResourceTypeService.cs b/src/Services/ResourceTypeService.cs index 44df71a..c1a1c2a 100644 --- a/src/Services/ResourceTypeService.cs +++ b/src/Services/ResourceTypeService.cs @@ -485,8 +485,17 @@ public static async Task ValidateResourceTypeName(ValidateNameR List resourceTypes = (List)serviceResponse.ResponseObject!; if (GeneralHelper.IsNotNull(resourceTypes)) { - // Get the specified resoure type - ResourceType resourceType = resourceTypes.FirstOrDefault(x => x.ShortName == validateNameRequest.ResourceType)!; + ResourceType resourceType = null; + if (GeneralHelper.IsNotNull(validateNameRequest.ResourceTypeId)) + { + // Get the specified resoure type by id + resourceType = resourceTypes.FirstOrDefault(x => x.Id == validateNameRequest.ResourceTypeId)!; + } + else + { + // Get the specified resoure type by short name + resourceType = resourceTypes.FirstOrDefault(x => x.ShortName == validateNameRequest.ResourceType)!; + } if (GeneralHelper.IsNotNull(resourceType)) { // Create a validate name request diff --git a/src/programsettings.json b/src/programsettings.json index dc81a77..fe4c270 100644 --- a/src/programsettings.json +++ b/src/programsettings.json @@ -1,5 +1,5 @@ { "FeedbackURL": "https://forms.office.com/r/M2EZLg6zKq", "latestNewsEnabled": "false", - "toolVersion":"3.1.0" + "toolVersion":"3.1.1" }