Skip to content

Bug fix regarding Get-AzHealthcareApisService not showing accurate fhir type #9976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 5, 2019
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 @@ -47,6 +47,7 @@ function Test-AzRmHealthcareApisService{
# Assert
Assert-AreEqual $actual.Name $rname
Assert-AreEqual $actual.Properties.CosmosDbConfiguration.OfferThroughput $offerThroughput
Assert-AreEqual $actual.Kind $kind
#Update using parameters
$newOfferThroughput = $offerThroughput - 600
$updated = Set-AzHealthcareApisService -ResourceId $actual.Id -CosmosOfferThroughput $newOfferThroughput;
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/HealthcareApis/HealthcareApis/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Added Error Handling in all cmdlets
* Fixed few typos
* Enable Set-AzHealthcareApisService to allow updating tags.
* Fixed bug around inaccurate kind

## Version 0.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.HealthcareApis.Models;
using Microsoft.Azure.Commands.HealthcareApis.Properties;
using Microsoft.Azure.Commands.ResourceManager.Common;
using Microsoft.Azure.Graph.RBAC.Version1_6.ActiveDirectory;
using Microsoft.Azure.Management.HealthcareApis;
Expand Down Expand Up @@ -193,5 +194,25 @@ public static ErrorRecord WriteErrorforBadrequest(ErrorDetailsException ex)
return new ErrorRecord(emptyEx, "Response object was empty", ErrorCategory.OpenError, emptyEx);
}
}

public static Kind ParseKind(string kind)
{
if (kind.Equals("fhir", StringComparison.OrdinalIgnoreCase))
{
return Management.HealthcareApis.Models.Kind.Fhir;
}
else if (kind.Equals("fhir-stu3", StringComparison.OrdinalIgnoreCase) || kind.Equals("stu3", StringComparison.OrdinalIgnoreCase))
{
return Management.HealthcareApis.Models.Kind.FhirStu3;
}
else if (kind.Equals("fhir-r4", StringComparison.OrdinalIgnoreCase) || kind.Equals("r4", StringComparison.OrdinalIgnoreCase))
{
return Management.HealthcareApis.Models.Kind.FhirR4;
}
else
{
throw new PSArgumentException(Resources.createService_InvalidKindMessage);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,26 +248,6 @@ private Kind ParseKindFromVersion(string fhirVersion)
return ParseKind(FhirVersion);
}

private Kind ParseKind(string kind)
{
if (kind.Equals("fhir", StringComparison.OrdinalIgnoreCase))
{
return Management.HealthcareApis.Models.Kind.Fhir;
}
else if (kind.Equals("fhir-stu3", StringComparison.OrdinalIgnoreCase) || kind.Equals("stu3", StringComparison.OrdinalIgnoreCase))
{
return Management.HealthcareApis.Models.Kind.FhirStu3;
}
else if (kind.Equals("fhir-r4", StringComparison.OrdinalIgnoreCase) || kind.Equals("r4", StringComparison.OrdinalIgnoreCase))
{
return Management.HealthcareApis.Models.Kind.FhirR4;
}
else
{
throw new PSArgumentException(Resources.createService_InvalidKindMessage);
}
}

private int? GetCosmosDBThroughput()
{
if (CosmosOfferThroughput == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ private ServicesDescription InputObjectToServiceDescription(ServicesDescription
},
AccessPolicies = accessPolicies
},
Kind = InputObject.Kind,
Kind = ParseKind(InputObject.Kind),
Tags = InputObject.Tags
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public PSHealthcareApisService(ServicesDescription serviceDescription)
this.Tags = serviceDescription.Tags;
this.Properties = new PSHealthcareApisServiceConfig(serviceDescription.Properties);
this.Etag = serviceDescription.Etag;
this.Kind = serviceDescription.Kind;
this.Kind = GetKindValue(serviceDescription.Kind);
}

public string ResourceGroupName { get; private set; }
Expand All @@ -43,7 +43,7 @@ public PSHealthcareApisService(ServicesDescription serviceDescription)

public string ResourceType { get; private set; }

public Kind Kind { get; private set; }
public string Kind { get; private set; }

public IDictionary<string, string> Tags { get; private set; }

Expand All @@ -68,6 +68,18 @@ private static string ParseResourceGroupFromId(string idFromServer)
return null;
}


private static string GetKindValue(Kind kind)
{
switch (kind)
{
case Management.HealthcareApis.Models.Kind.Fhir:
return "fhir";
case Management.HealthcareApis.Models.Kind.FhirStu3:
return "fhir-Stu3";
case Management.HealthcareApis.Models.Kind.FhirR4:
return "fhir-R4";
}
return null;
}
}
}