diff --git a/fusionauth-netcore-client/domain/io/fusionauth/domain/api/StatusResponse.cs b/fusionauth-netcore-client/domain/io/fusionauth/domain/api/StatusResponse.cs new file mode 100644 index 00000000..4723416b --- /dev/null +++ b/fusionauth-netcore-client/domain/io/fusionauth/domain/api/StatusResponse.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018-2023, FusionAuth, All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ + + +using System.Collections.Generic; +using System; + +namespace io.fusionauth.domain.api +{ + + /** + * The public Status API response + * + * @author Daniel DeGroff + */ + public class StatusResponse: Dictionary { + + public StatusResponse with(Action action) { + action(this); + return this; + } + } +} diff --git a/fusionauth-netcore-client/src/io/fusionauth/FusionAuthClient.cs b/fusionauth-netcore-client/src/io/fusionauth/FusionAuthClient.cs index efffc4bf..4a41f094 100644 --- a/fusionauth-netcore-client/src/io/fusionauth/FusionAuthClient.cs +++ b/fusionauth-netcore-client/src/io/fusionauth/FusionAuthClient.cs @@ -2229,6 +2229,30 @@ public Task> RetrieveSystemConfigura .goAsync(); } + /// + public Task> RetrieveSystemHealthAsync() { + return buildAnonymousClient() + .withUri("/api/health") + .withMethod("Get") + .goAsync(); + } + + /// + public Task> RetrieveSystemStatusAsync() { + return buildAnonymousClient() + .withUri("/api/status") + .withMethod("Get") + .goAsync(); + } + + /// + public Task> RetrieveSystemStatusUsingAPIKeyAsync() { + return buildClient() + .withUri("/api/status") + .withMethod("Get") + .goAsync(); + } + /// public Task> RetrieveTenantAsync(Guid? tenantId) { return buildClient() diff --git a/fusionauth-netcore-client/src/io/fusionauth/FusionAuthSyncClient.cs b/fusionauth-netcore-client/src/io/fusionauth/FusionAuthSyncClient.cs index 20811949..3243d6f9 100644 --- a/fusionauth-netcore-client/src/io/fusionauth/FusionAuthSyncClient.cs +++ b/fusionauth-netcore-client/src/io/fusionauth/FusionAuthSyncClient.cs @@ -1162,6 +1162,21 @@ public ClientResponse RetrieveSystemConfiguration() return client.RetrieveSystemConfigurationAsync().GetAwaiter().GetResult(); } + /// + public ClientResponse RetrieveSystemHealth() { + return client.RetrieveSystemHealthAsync().GetAwaiter().GetResult(); + } + + /// + public ClientResponse RetrieveSystemStatus() { + return client.RetrieveSystemStatusAsync().GetAwaiter().GetResult(); + } + + /// + public ClientResponse RetrieveSystemStatusUsingAPIKey() { + return client.RetrieveSystemStatusUsingAPIKeyAsync().GetAwaiter().GetResult(); + } + /// public ClientResponse RetrieveTenant(Guid? tenantId) { return client.RetrieveTenantAsync(tenantId).GetAwaiter().GetResult(); diff --git a/fusionauth-netcore-client/src/io/fusionauth/IFusionAuthClient.cs b/fusionauth-netcore-client/src/io/fusionauth/IFusionAuthClient.cs index 27b81074..7e2744f3 100644 --- a/fusionauth-netcore-client/src/io/fusionauth/IFusionAuthClient.cs +++ b/fusionauth-netcore-client/src/io/fusionauth/IFusionAuthClient.cs @@ -3136,6 +3136,42 @@ public interface IFusionAuthAsyncClient { /// Task> RetrieveSystemConfigurationAsync(); + /// + /// Retrieves the FusionAuth system health. This API will return 200 if the system is healthy, and 500 if the system is un-healthy. + /// This is an asynchronous method. + /// + /// + /// When successful, the response will contain the log of the action. If there was a validation error or any + /// other type of error, this will return the Errors object in the response. Additionally, if FusionAuth could not be + /// contacted because it is down or experiencing a failure, the response will contain an Exception, which could be an + /// IOException. + /// + Task> RetrieveSystemHealthAsync(); + + /// + /// Retrieves the FusionAuth system status. This request is anonymous and does not require an API key. When an API key is not provided the response will contain a single value in the JSON response indicating the current health check. + /// This is an asynchronous method. + /// + /// + /// When successful, the response will contain the log of the action. If there was a validation error or any + /// other type of error, this will return the Errors object in the response. Additionally, if FusionAuth could not be + /// contacted because it is down or experiencing a failure, the response will contain an Exception, which could be an + /// IOException. + /// + Task> RetrieveSystemStatusAsync(); + + /// + /// Retrieves the FusionAuth system status using an API key. Using an API key will cause the response to include the product version, health checks and various runtime metrics. + /// This is an asynchronous method. + /// + /// + /// When successful, the response will contain the log of the action. If there was a validation error or any + /// other type of error, this will return the Errors object in the response. Additionally, if FusionAuth could not be + /// contacted because it is down or experiencing a failure, the response will contain an Exception, which could be an + /// IOException. + /// + Task> RetrieveSystemStatusUsingAPIKeyAsync(); + /// /// Retrieves the tenant for the given Id. /// This is an asynchronous method. @@ -7680,6 +7716,39 @@ public interface IFusionAuthSyncClient { /// ClientResponse RetrieveSystemConfiguration(); + /// + /// Retrieves the FusionAuth system health. This API will return 200 if the system is healthy, and 500 if the system is un-healthy. + /// + /// + /// When successful, the response will contain the log of the action. If there was a validation error or any + /// other type of error, this will return the Errors object in the response. Additionally, if FusionAuth could not be + /// contacted because it is down or experiencing a failure, the response will contain an Exception, which could be an + /// IOException. + /// + ClientResponse RetrieveSystemHealth(); + + /// + /// Retrieves the FusionAuth system status. This request is anonymous and does not require an API key. When an API key is not provided the response will contain a single value in the JSON response indicating the current health check. + /// + /// + /// When successful, the response will contain the log of the action. If there was a validation error or any + /// other type of error, this will return the Errors object in the response. Additionally, if FusionAuth could not be + /// contacted because it is down or experiencing a failure, the response will contain an Exception, which could be an + /// IOException. + /// + ClientResponse RetrieveSystemStatus(); + + /// + /// Retrieves the FusionAuth system status using an API key. Using an API key will cause the response to include the product version, health checks and various runtime metrics. + /// + /// + /// When successful, the response will contain the log of the action. If there was a validation error or any + /// other type of error, this will return the Errors object in the response. Additionally, if FusionAuth could not be + /// contacted because it is down or experiencing a failure, the response will contain an Exception, which could be an + /// IOException. + /// + ClientResponse RetrieveSystemStatusUsingAPIKey(); + /// /// Retrieves the tenant for the given Id. ///