-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
622 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: HealthChecks Aws Sns CD | ||
|
||
on: | ||
push: | ||
tags: | ||
- release-aws_sns-* # Push events to release-aws_sns* | ||
jobs: | ||
build: | ||
env: | ||
BUILD_CONFIG: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: 6.0.202 | ||
include-prerelease: false | ||
- name: Restore | ||
run: dotnet restore ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj | ||
- name: Build | ||
run: dotnet build --no-restore ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj -c $BUILD_CONFIG | ||
- name: Pack | ||
run: dotnet pack --no-build ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj -c $BUILD_CONFIG -o ./artifacts | ||
- name: Publish | ||
run: dotnet nuget push ./artifacts/AspNetCore.HealthChecks.Aws.Sns.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: HealthChecks Aws Sns Preview CD | ||
|
||
on: | ||
push: | ||
tags: | ||
- preview-aws_sns-* | ||
jobs: | ||
build: | ||
env: | ||
BUILD_CONFIG: Release | ||
VERSION_SUFFIX: -rc2.${{ github.run_number }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: 6.0.202 | ||
include-prerelease: false | ||
- name: Restore | ||
run: dotnet restore ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj | ||
- name: Build | ||
run: dotnet build --no-restore ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj -c $BUILD_CONFIG | ||
- name: Pack | ||
run: dotnet pack --no-build ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj --version-suffix $VERSION_SUFFIX -c $BUILD_CONFIG -o ./artifacts | ||
- name: Publish | ||
run: dotnet nuget push ./artifacts/AspNetCore.HealthChecks.Aws.Sns.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: HealthChecks Aws Sns CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- src/HealthChecks.Aws.Sns/** | ||
- test/HealthChecks.Aws.Sns.Tests/** | ||
- .github/workflows/healthchecks_aws_sns_ci.yml | ||
- Directory.Build.props | ||
- Directory.Build.targets | ||
tags-ignore: | ||
- release-* | ||
|
||
pull_request: | ||
branches: [ master ] | ||
paths: | ||
- src/HealthChecks.Aws.Sns/** | ||
- test/HealthChecks.Aws.Sns.Tests/** | ||
- .github/workflows/healthchecks_aws_sns_ci.yml | ||
- Directory.Build.props | ||
- Directory.Build.targets | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: 6.0.202 | ||
include-prerelease: false | ||
- name: Restore | ||
run: | | ||
dotnet restore ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj && | ||
dotnet restore ./test/HealthChecks.Aws.Sns.Tests/HealthChecks.Aws.Sns.Tests.csproj | ||
- name: Check formatting | ||
run: | | ||
dotnet format --no-restore --verify-no-changes --severity warn ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj || (echo "Run 'dotnet format' to fix issues" && exit 1) && | ||
dotnet format --no-restore --verify-no-changes --severity warn ./test/HealthChecks.Aws.Sns.Tests/HealthChecks.Aws.Sns.Tests.csproj || (echo "Run 'dotnet format' to fix issues" && exit 1) | ||
- name: Build | ||
run: | | ||
dotnet build --no-restore ./src/HealthChecks.Aws.Sns/HealthChecks.Aws.Sns.csproj && | ||
dotnet build --no-restore ./test/HealthChecks.Aws.Sns.Tests/HealthChecks.Aws.Sns.Tests.csproj | ||
- name: Test | ||
run: dotnet test --no-restore --no-build ./test/HealthChecks.Aws.Sns.Tests/HealthChecks.Aws.Sns.Tests.csproj | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/HealthChecks.Aws.Sns/DependencyInjection/SnsHealthCheckBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using HealthChecks.Aws.Sns; | ||
using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
/// <summary> | ||
/// Extension methods to configure <see cref="SnsTopicAndSubscriptionHealthCheck"/>. | ||
/// </summary> | ||
public static class SnsHealthCheckBuilderExtensions | ||
{ | ||
private const string AWS_NAME_SNS_SUBS = "aws sns subs"; | ||
|
||
/// <summary> | ||
/// Add a health check for AWS SNS topics and optional subscriptions. | ||
/// </summary> | ||
/// <param name="builder">The <see cref="IHealthChecksBuilder"/>.</param> | ||
/// <param name="setup">The action to configure the SNS connection parameters.</param> | ||
/// <param name="name">The health check name. Optional. If <c>null</c> the type name 'aws sns subs' will be used for the name.</param> | ||
/// <param name="failureStatus"> | ||
/// The <see cref="HealthStatus"/> that should be reported when the health check fails. Optional. If <c>null</c> then | ||
/// the default status of <see cref="HealthStatus.Unhealthy"/> will be reported. | ||
/// </param> | ||
/// <param name="tags">A list of tags that can be used to filter sets of health checks. Optional.</param> | ||
/// <param name="timeout">An optional <see cref="TimeSpan"/> representing the timeout of the check.</param> | ||
/// <returns>The specified <paramref name="builder"/>.</returns> | ||
public static IHealthChecksBuilder AddSnsTopicsAndSubscriptions( | ||
this IHealthChecksBuilder builder, | ||
Action<SnsOptions>? setup, | ||
string? name = default, | ||
HealthStatus? failureStatus = default, | ||
IEnumerable<string>? tags = default, | ||
TimeSpan? timeout = default) | ||
{ | ||
var options = new SnsOptions(); | ||
setup?.Invoke(options); | ||
|
||
return builder.Add(new HealthCheckRegistration( | ||
name ?? AWS_NAME_SNS_SUBS, | ||
sp => new SnsTopicAndSubscriptionHealthCheck(options), | ||
failureStatus, | ||
tags, | ||
timeout)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(NetFrameworkVersion);$(NetStandardVersion)</TargetFrameworks> | ||
<PackageTags>$(PackageTags);AWS;SNS;Amazon Simple Notification Service</PackageTags> | ||
<Description>HealthChecks.Aws.Sns is the health check package for Amazon Simple Notification Service.</Description> | ||
<Version>$(HealthCheckAWSSns)</Version> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AWSSDK.SimpleNotificationService" Version="3.7.3.50" /> | ||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.6" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.