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 @@ -21,15 +21,15 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/astar-development/astar-dev-api-health-checks</PackageProjectUrl>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<PackageReleaseNotes>Removes the defunct Health Check, leaving the 'Result' object-based version.</PackageReleaseNotes>
<PackageReleaseNotes>Drop AStar.Dev.Function.Extensions for CSharpFunctionalExtensions</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>ASP.Core HealthChecks;HealthChecks</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/astar-development/astar-dev-api-health-checks.git</RepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFramework>net9.0</TargetFramework>
<Title>AStar API HealthChecks</Title>
<Version>0.4.1</Version>
<Version>0.4.2</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -43,7 +43,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AStar.Dev.Functional.Extensions" Version="0.2.0"/>
<PackageReference Include="CSharpFunctionalExtensions" Version="3.6.0"/>
<PackageReference Include="AStar.Dev.Technical.Debt.Reporting" Version="0.1.0"/>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="9.0.4"/>
<PackageReference Include="Microsoft.Extensions.Features" Version="9.0.4"/>
Expand All @@ -60,7 +60,7 @@
</None>
<None Update="Readme.md">
<Pack>true</Pack>
<PackagePath></PackagePath>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

Expand Down
22 changes: 17 additions & 5 deletions src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/AStar.Dev.Api.HealthChecks/HealthStatusResponse.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
namespace AStar.Dev.Api.HealthChecks;

/// <summary>
/// The <see cref="HealthStatusResponse" /> class contains a strongly-typed response for the Health Checks to use
/// </summary>
public sealed record HealthStatusResponse
{
/// <summary>
/// Gets or sets the name of the Health Check
/// </summary>
public string Name { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the description of the Health Status response
/// </summary>
public string? Description { get; set; } = "Unable to retrieve the description of the Health Status";

/// <summary>
/// Gets or sets the Status of the Health Status response
/// </summary>
public string Status { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the milliseconds the Health Check took to complete
/// </summary>
public double DurationInMilliseconds { get; set; }

/// <summary>
/// TBH, not sure if this is populated anywhere at the time of writing
/// </summary>
public IReadOnlyDictionary<string, object>? Data { get; set; }

/// <summary>
/// Gets or sets the <see cref="Exception" /> (or derived type) encountered during the Health Check call
/// </summary>
public string? Exception { get; set; } = string.Empty;
}
4 changes: 2 additions & 2 deletions src/AStar.Dev.Api.HealthChecks/IApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using AStar.Dev.Functional.Extensions;
using CSharpFunctionalExtensions;

namespace AStar.Dev.Api.HealthChecks;

Expand All @@ -12,7 +12,7 @@ public interface IApiClient
/// </summary>
/// <param name="cancellationToken">The token to optionally use to cancel the operation</param>
/// <returns>
/// An instance of the <see cref="Result{TError,TSuccess}" /> class wrapping an instance of the <see href="HealthStatusResponse"></see> class when successful (containing the text representation of
/// An instance of the <see cref="Result" /> class wrapping an instance of the <see href="HealthStatusResponse"></see> class when successful (containing the text representation of
/// the API Health Status). When the call fails, a string error message will be returned
/// </returns>
public Task<Result<string, HealthStatusResponse>> GetHealthCheckAsync(CancellationToken cancellationToken = default);
Expand Down
23 changes: 22 additions & 1 deletion src/AStar.Dev.Api.HealthChecks/Readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
Update
# AStar.Dev.Api.HealthChecks

This NuGet package, as the name suggests, contains the generic methods for making Health-Check calls to the AStar Dev APIs

## GitHub build

[![.NET](https://github.com/astar-development/astar-dev-api-health-checks/actions/workflows/dotnet.yml/badge.svg)](https://github.com/astar-development/astar-dev-api-health-checks/actions/workflows/dotnet.yml)

## SonarCloud Analysis Results

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks)

[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=bugs)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks)

[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks)

[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks)

[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=coverage)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks)

[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks)

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AStar.Dev.Utilities" Version="1.6.0"/>
<PackageReference Include="AStar.Dev.Utilities" Version="1.6.1"/>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace AStar.Dev.Api.HealthChecks;

[TestSubject(typeof(HealthCheckExtensions))]
public class HealthCheckExtensionsShould()
public class HealthCheckExtensionsShould
{
[Fact]
public void ConfigureTheHealthCheckEndpoints()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class HealthStatusResponseShould
[Fact]
public void ContainTheExpectedProperties()
{
new HealthStatusResponse(){Name = "Test Name", Description = "Test Description", DurationInMilliseconds = 123, Data = new Dictionary<string, object>(), Exception = "Test Exception", Status = "OK"}
new HealthStatusResponse
{ Name = "Test Name", Description = "Test Description", DurationInMilliseconds = 123, Data = new Dictionary<string, object>(), Exception = "Test Exception", Status = "OK" }
.ToJson().ShouldMatchApproved();
}
}