Skip to content

Commit

Permalink
Hub model namespace refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
webprofusion-chrisc committed Nov 10, 2024
1 parent 720a8ec commit 554b2c7
Show file tree
Hide file tree
Showing 39 changed files with 86 additions and 114 deletions.
3 changes: 1 addition & 2 deletions src/Certify.Client/CertifyApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Certify.Models.Hub;
using Certify.Models;
using Certify.Models.API;
using Certify.Models.Config;
using Certify.Models.Config.AccessControl;
using Certify.Models.Reporting;
using Certify.Models.Utils;
using Certify.Shared;
Expand Down
51 changes: 2 additions & 49 deletions src/Certify.Client/ICertifyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Certify.Models.Config;
using Certify.Models.Reporting;
using Certify.Models.Utils;
using Certify.Models.Hub;
using Certify.Shared;

namespace Certify.Client
Expand All @@ -15,118 +16,75 @@ namespace Certify.Client
/// </summary>
public partial interface ICertifyInternalApiClient
{

#region System

Task<string> GetAppVersion(AuthContext authContext = null);

Task<UpdateCheck> CheckForUpdates(AuthContext authContext = null);

Task<List<Models.Config.ActionResult>> PerformServiceDiagnostics(AuthContext authContext = null);
Task<List<Models.Config.ActionResult>> PerformManagedCertMaintenance(string id = null, AuthContext authContext = null);

Task<List<ActionStep>> SetDefaultDataStore(string dataStoreId, AuthContext authContext = null);
Task<List<ProviderDefinition>> GetDataStoreProviders(AuthContext authContext = null);
Task<List<DataStoreConnection>> GetDataStoreConnections(AuthContext authContext = null);
Task<List<ActionStep>> CopyDataStore(string sourceId, string targetId, AuthContext authContext = null);
Task<List<ActionStep>> UpdateDataStoreConnection(DataStoreConnection dataStoreConnection, AuthContext authContext = null);
Task<List<ActionStep>> TestDataStoreConnection(DataStoreConnection dataStoreConnection, AuthContext authContext = null);

#endregion System

#region Server
Task<bool> IsServerAvailable(StandardServerTypes serverType, AuthContext authContext = null);

Task<List<SiteInfo>> GetServerSiteList(StandardServerTypes serverType, string itemId = null, AuthContext authContext = null);

Task<Version> GetServerVersion(StandardServerTypes serverType, AuthContext authContext = null);

Task<List<DomainOption>> GetServerSiteDomains(StandardServerTypes serverType, string serverSiteId, AuthContext authContext = null);

Task<List<ActionStep>> RunConfigurationDiagnostics(StandardServerTypes serverType, string serverSiteId, AuthContext authContext = null);

Task<List<SimpleAuthorizationChallengeItem>> GetCurrentChallenges(string type, string key, AuthContext authContext = null);

#endregion Server

#region Preferences

Task<Preferences> GetPreferences(AuthContext authContext = null);

Task<bool> SetPreferences(Preferences preferences, AuthContext authContext = null);

#endregion Preferences

#region Credentials

Task<List<StoredCredential>> GetCredentials(AuthContext authContext = null);

Task<StoredCredential> UpdateCredentials(StoredCredential credential, AuthContext authContext = null);

Task<bool> DeleteCredential(string credentialKey, AuthContext authContext = null);

Task<ActionResult> TestCredentials(string credentialKey, AuthContext authContext = null);

#endregion Credentials

#region Managed Certificates

Task<List<ManagedCertificate>> GetManagedCertificates(ManagedCertificateFilter filter, AuthContext authContext = null);
Task<ManagedCertificateSearchResult> GetManagedCertificateSearchResult(ManagedCertificateFilter filter, AuthContext authContext = null);
Task<StatusSummary> GetManagedCertificateSummary(ManagedCertificateFilter filter, AuthContext authContext = null);

Task<ManagedCertificate> GetManagedCertificate(string managedItemId, AuthContext authContext = null);

Task<ManagedCertificate> UpdateManagedCertificate(ManagedCertificate site, AuthContext authContext = null);

Task<bool> DeleteManagedCertificate(string managedItemId, AuthContext authContext = null);

Task<StatusMessage> RevokeManageSiteCertificate(string managedItemId, AuthContext authContext = null);

Task<List<CertificateRequestResult>> BeginAutoRenewal(RenewalSettings settings, AuthContext authContext = null);

Task<List<CertificateRequestResult>> RedeployManagedCertificates(bool isPreviewOnly, bool includeDeploymentTasks, AuthContext authContext = null);

Task<CertificateRequestResult> ReapplyCertificateBindings(string managedItemId, bool isPreviewOnly, bool includeDeploymentTasks, AuthContext authContext = null);

Task<CertificateRequestResult> RefetchCertificate(string managedItemId, AuthContext authContext = null);

Task<CertificateRequestResult> BeginCertificateRequest(string managedItemId, bool resumePaused, bool isInteractive, AuthContext authContext = null);

Task<List<StatusMessage>> TestChallengeConfiguration(ManagedCertificate site, AuthContext authContext = null);
Task<List<StatusMessage>> PerformChallengeCleanup(ManagedCertificate site, AuthContext authContext = null);

Task<List<Models.Providers.DnsZone>> GetDnsProviderZones(string providerTypeId, string credentialId, AuthContext authContext = null);

Task<List<ActionStep>> PreviewActions(ManagedCertificate site, AuthContext authContext = null);

Task<List<ChallengeProviderDefinition>> GetChallengeAPIList(AuthContext authContext = null);

Task<List<DeploymentProviderDefinition>> GetDeploymentProviderList(AuthContext authContext = null);

Task<DeploymentProviderDefinition> GetDeploymentProviderDefinition(string id, Config.DeploymentTaskConfig config, AuthContext authContext = null);

Task<List<ActionStep>> PerformDeployment(string managedCertificateId, string taskId, bool isPreviewOnly, bool forceTaskExecute, AuthContext authContext = null);

Task<List<ActionResult>> ValidateDeploymentTask(DeploymentTaskValidationInfo info, AuthContext authContext = null);

Task<Models.API.LogItem[]> GetItemLog(string id, int limit, AuthContext authContext = null);

Task<LogItem[]> GetItemLog(string id, int limit, AuthContext authContext = null);
#endregion Managed Certificates

#region Accounts
Task<List<CertificateAuthority>> GetCertificateAuthorities(AuthContext authContext = null);

Task<ActionResult> UpdateCertificateAuthority(CertificateAuthority ca, AuthContext authContext = null);
Task<ActionResult> DeleteCertificateAuthority(string id, AuthContext authContext = null);
Task<List<AccountDetails>> GetAccounts(AuthContext authContext = null);
Task<ActionResult> AddAccount(ContactRegistration contact, AuthContext authContext = null);
Task<ActionResult> UpdateAccountContact(ContactRegistration contact, AuthContext authContext = null);
Task<ActionResult> RemoveAccount(string storageKey, bool deactivate, AuthContext authContext = null);
Task<ActionResult> ChangeAccountKey(string storageKey, string newKeyPEM = null, AuthContext authContext = null);

#endregion Accounts

}

/// <summary>
Expand All @@ -135,15 +93,10 @@ public partial interface ICertifyInternalApiClient
public interface ICertifyClient : ICertifyInternalApiClient
{
event Action<string, string> OnMessageFromService;

event Action<RequestProgressState> OnRequestProgressStateUpdated;

event Action<ManagedCertificate> OnManagedCertificateUpdated;

Task ConnectStatusStreamAsync();

Shared.ServerConnection GetConnectionInfo();

Task<bool> EnsureServiceHubConnected();
}
}
2 changes: 1 addition & 1 deletion src/Certify.Client/ManagementServerClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Threading.Tasks;
using Certify.API.Management;
using Certify.Models.Hub;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.DependencyInjection;

Expand Down
3 changes: 1 addition & 2 deletions src/Certify.Core/Management/Access/AccessControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Certify.Models.API;
using Certify.Models.Config.AccessControl;
using Certify.Models.Hub;
using Certify.Models.Providers;
using Certify.Providers;

Expand Down
3 changes: 1 addition & 2 deletions src/Certify.Core/Management/Access/IAccessControl.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Certify.Models.API;
using Certify.Models.Config.AccessControl;
using Certify.Models.Hub;

namespace Certify.Core.Management.Access
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using System.Threading;
using System.Threading.Tasks;
using Certify.Core.Management.Access;
using Certify.Models.Hub;
using Certify.Models;
using Certify.Models.Config;
using Certify.Models.Config.AccessControl;
using Certify.Models.Shared;

namespace Certify.Management
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Certify.Models.Hub;
using Certify.Models;
using Certify.Models.API;
using Certify.Models.Providers;
using Certify.Models.Reporting;
using Certify.Models.Shared;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Certify.API.Management;
using Certify.Client;
using Certify.Models.Hub;
using Certify.Models;
using Certify.Models.Config;
using Certify.Shared.Core.Utils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Certify.Config;
using Certify.Models.Hub;
using Certify.Models;
using Certify.Models.API;
using Certify.Models.Config;
using Certify.Models.Config.Migration;
using Certify.Models.Providers;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace Certify.Models.Config.AccessControl
namespace Certify.Models.Hub
{
public class AccessStoreItem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace Certify.Models.Config.AccessControl
namespace Certify.Models.Hub
{
public enum SecurityPrincipleType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Certify.Models.Config.AccessControl;

namespace Certify.Models.API
namespace Certify.Models.Hub
{
/// <summary>
/// Required info to begin auth
Expand Down Expand Up @@ -40,7 +38,7 @@ public class AuthResponse
/// </summary>
public string RefreshToken { get; set; } = string.Empty;

public Models.Config.AccessControl.SecurityPrinciple? SecurityPrinciple { get; set; }
public SecurityPrinciple? SecurityPrinciple { get; set; }

public RoleStatus? RoleStatus { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace Certify.Models.API
namespace Certify.Models.Hub
{
public class LogItem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using Certify.Models;

namespace Certify.Models.API
namespace Certify.Models.Hub
{
/// <summary>
/// Summary information for a managed certificate
Expand Down
25 changes: 25 additions & 0 deletions src/Certify.Models/Hub/ManagedChallenge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using Certify.Models;

namespace Certify.Models.Hub
{
/// <summary>
/// Configuration for a managed challenge, such as a DNS challenge for a specific domain/zone
/// A managed challenge is one the management hub can complete on behalf of another ACME client
/// </summary>
public class ManagedChallenge
{
public ManagedChallenge()
{
Id = Guid.NewGuid().ToString();
}
public string Id { get; set; }
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string ItemType { get; set; } = string.Empty;

public CertRequestChallengeConfig ChallengeConfig { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using Certify.Models;

namespace Certify.API.Management
namespace Certify.Models.Hub
{
public class ManagedInstanceInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace Certify.API.Management
namespace Certify.Models.Hub
{
public class ManagementHubMessages
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Certify.Models.API
namespace Certify.Models.Hub
{
public class VersionInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
using Certify.Models.Config;
using Certify.Models.API;
using Certify.Models.Providers;
using Certify.Models.Config.AccessControl;
using Certify.Models.Hub;
using Certify.Models.Config.Migration;
using Certify.API.Management;

#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@
"Certify.Models.Config",
"Certify.Models.API",
"Certify.Models.Providers",
"Certify.Models.Config.AccessControl",
"Certify.Models.Config.Migration",
"Certify.API.Management"
"Certify.Models.Hub",
"Certify.Models.Config.Migration"
],
"additionalContractNamespaceUsages": [],
"generateOptionalParameters": false,
Expand Down Expand Up @@ -115,4 +114,4 @@
"newLineBehavior": "Auto"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Certify.API.Management;
using Certify.Client;
using Certify.Models.API;
using Certify.Client;
using Certify.Models.Hub;
using Certify.Server.Api.Public.SignalR.ManagementHub;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Net.Http.Headers;
using System.Security.Claims;
using Certify.Client;
using Certify.Models.API;
using Certify.Models.Hub;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Certify.Client;
using Certify.Models.API;
using Certify.Models.Hub;
using Certify.Models.Reporting;
using Certify.Server.Api.Public.Services;
using Microsoft.AspNetCore.Authentication.JwtBearer;
Expand Down
Loading

0 comments on commit 554b2c7

Please sign in to comment.