Skip to content

Commit

Permalink
client sync
Browse files Browse the repository at this point in the history
  • Loading branch information
robotdan committed Jun 24, 2024
1 parent f06a40a commit 361c1ac
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<string, object> {

public StatusResponse with(Action<StatusResponse> action) {
action(this);
return this;
}
}
}
24 changes: 24 additions & 0 deletions fusionauth-netcore-client/src/io/fusionauth/FusionAuthClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,30 @@ public Task<ClientResponse<SystemConfigurationResponse>> RetrieveSystemConfigura
.goAsync<SystemConfigurationResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<RESTVoid>> RetrieveSystemHealthAsync() {
return buildAnonymousClient()
.withUri("/api/health")
.withMethod("Get")
.goAsync<RESTVoid>();
}

/// <inheritdoc/>
public Task<ClientResponse<StatusResponse>> RetrieveSystemStatusAsync() {
return buildAnonymousClient()
.withUri("/api/status")
.withMethod("Get")
.goAsync<StatusResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<StatusResponse>> RetrieveSystemStatusUsingAPIKeyAsync() {
return buildClient()
.withUri("/api/status")
.withMethod("Get")
.goAsync<StatusResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<TenantResponse>> RetrieveTenantAsync(Guid? tenantId) {
return buildClient()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,21 @@ public ClientResponse<SystemConfigurationResponse> RetrieveSystemConfiguration()
return client.RetrieveSystemConfigurationAsync().GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<RESTVoid> RetrieveSystemHealth() {
return client.RetrieveSystemHealthAsync().GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<StatusResponse> RetrieveSystemStatus() {
return client.RetrieveSystemStatusAsync().GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<StatusResponse> RetrieveSystemStatusUsingAPIKey() {
return client.RetrieveSystemStatusUsingAPIKeyAsync().GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<TenantResponse> RetrieveTenant(Guid? tenantId) {
return client.RetrieveTenantAsync(tenantId).GetAwaiter().GetResult();
Expand Down
69 changes: 69 additions & 0 deletions fusionauth-netcore-client/src/io/fusionauth/IFusionAuthClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,42 @@ public interface IFusionAuthAsyncClient {
/// </returns>
Task<ClientResponse<SystemConfigurationResponse>> RetrieveSystemConfigurationAsync();

/// <summary>
/// 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.
/// </summary>
/// <returns>
/// 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.
/// </returns>
Task<ClientResponse<RESTVoid>> RetrieveSystemHealthAsync();

/// <summary>
/// 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.
/// </summary>
/// <returns>
/// 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.
/// </returns>
Task<ClientResponse<StatusResponse>> RetrieveSystemStatusAsync();

/// <summary>
/// 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.
/// </summary>
/// <returns>
/// 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.
/// </returns>
Task<ClientResponse<StatusResponse>> RetrieveSystemStatusUsingAPIKeyAsync();

/// <summary>
/// Retrieves the tenant for the given Id.
/// This is an asynchronous method.
Expand Down Expand Up @@ -7680,6 +7716,39 @@ public interface IFusionAuthSyncClient {
/// </returns>
ClientResponse<SystemConfigurationResponse> RetrieveSystemConfiguration();

/// <summary>
/// Retrieves the FusionAuth system health. This API will return 200 if the system is healthy, and 500 if the system is un-healthy.
/// </summary>
/// <returns>
/// 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.
/// </returns>
ClientResponse<RESTVoid> RetrieveSystemHealth();

/// <summary>
/// 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.
/// </summary>
/// <returns>
/// 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.
/// </returns>
ClientResponse<StatusResponse> RetrieveSystemStatus();

/// <summary>
/// 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.
/// </summary>
/// <returns>
/// 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.
/// </returns>
ClientResponse<StatusResponse> RetrieveSystemStatusUsingAPIKey();

/// <summary>
/// Retrieves the tenant for the given Id.
/// </summary>
Expand Down

0 comments on commit 361c1ac

Please sign in to comment.