diff --git a/src/Certify.Providers/DNS/CertifyDns/DnsProviderCertifyDns.cs b/src/Certify.Providers/DNS/CertifyDns/DnsProviderCertifyDns.cs index c73211c18..030868ae6 100644 --- a/src/Certify.Providers/DNS/CertifyDns/DnsProviderCertifyDns.cs +++ b/src/Certify.Providers/DNS/CertifyDns/DnsProviderCertifyDns.cs @@ -164,7 +164,7 @@ public DnsProviderCertifyDns() : base() } else { - // registration is not a valid certify dns registration, must be annother acme-dns service} + // registration is not a valid certify dns registration, must be another acme-dns service _log?.Warning("Existing acme-dns registration found, new registration required for Certify DNS"); } } diff --git a/src/Certify.Server/Certify.Server.Api.Public/Certify.Server.Api.Public.csproj b/src/Certify.Server/Certify.Server.Api.Public/Certify.Server.Api.Public.csproj index fd41d4c5f..477fb639f 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/Certify.Server.Api.Public.csproj +++ b/src/Certify.Server/Certify.Server.Api.Public/Certify.Server.Api.Public.csproj @@ -28,6 +28,6 @@ - + \ No newline at end of file diff --git a/src/Certify.SourceGenerators/ApiMethods.cs b/src/Certify.SourceGenerators/ApiMethods.cs index d8d8c1fba..b20149b0c 100644 --- a/src/Certify.SourceGenerators/ApiMethods.cs +++ b/src/Certify.SourceGenerators/ApiMethods.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using SourceGenerator; @@ -33,18 +33,17 @@ public static List GetApiDefinitions() return new List { - new GeneratedAPI { + new() { OperationName = "CheckSecurityPrincipleHasAccess", OperationMethod = HttpGet, - Comment = "Get list of Assigned Roles for a given security principle", + Comment = "Check a given security principle has permissions to perform a specific action for a specific resource type", PublicAPIController = "Access", PublicAPIRoute = "securityprinciple/{id}/allowedaction/{resourceType}/{resourceAction}/{identifier}", ServiceAPIRoute = "access/securityprinciple/{id}/allowedaction/{resourceType}/{resourceAction}/{identifier}", ReturnType = "bool", Params =new Dictionary{{"id","string"}, { "resourceType", "string" },{ "resourceAction", "string" }, { "identifier", "string" } } }, - new GeneratedAPI { - + new() { OperationName = "GetSecurityPrincipleAssignedRoles", OperationMethod = HttpGet, Comment = "Get list of Assigned Roles for a given security principle", @@ -54,8 +53,7 @@ public static List GetApiDefinitions() ReturnType = "ICollection", Params =new Dictionary{{"id","string"}} }, - new GeneratedAPI { - + new() { OperationName = "GetSecurityPrincipleRoleStatus", OperationMethod = HttpGet, Comment = "Get list of Assigned Roles etc for a given security principle", @@ -65,8 +63,7 @@ public static List GetApiDefinitions() ReturnType = "RoleStatus", Params =new Dictionary{{"id","string"}} }, - new GeneratedAPI { - + new() { OperationName = "GetAccessRoles", OperationMethod = HttpGet, Comment = "Get list of available security Roles", @@ -75,7 +72,7 @@ public static List GetApiDefinitions() ServiceAPIRoute = "access/roles", ReturnType = "ICollection" }, - new GeneratedAPI { + new() { OperationName = "GetSecurityPrinciples", OperationMethod = HttpGet, @@ -85,7 +82,7 @@ public static List GetApiDefinitions() ServiceAPIRoute = "access/securityprinciples", ReturnType = "ICollection" }, - new GeneratedAPI { + new() { OperationName = "ValidateSecurityPrinciplePassword", OperationMethod = HttpPost, Comment = "Check password valid for security principle", @@ -95,7 +92,7 @@ public static List GetApiDefinitions() ReturnType = "Certify.Models.Hub.SecurityPrincipleCheckResponse", Params = new Dictionary{{"passwordCheck", "Certify.Models.Hub.SecurityPrinciplePasswordCheck" } } }, - new GeneratedAPI { + new() { OperationName = "UpdateSecurityPrinciplePassword", OperationMethod = HttpPost, @@ -106,7 +103,7 @@ public static List GetApiDefinitions() ReturnType = "Models.Config.ActionResult", Params = new Dictionary{{"passwordUpdate", "Certify.Models.Hub.SecurityPrinciplePasswordUpdate" } } }, - new GeneratedAPI { + new() { OperationName = "AddSecurityPrinciple", OperationMethod = HttpPost, @@ -117,7 +114,7 @@ public static List GetApiDefinitions() ReturnType = "Models.Config.ActionResult", Params = new Dictionary{{"principle", "Certify.Models.Hub.SecurityPrinciple" } } }, - new GeneratedAPI { + new() { OperationName = "UpdateSecurityPrinciple", OperationMethod = HttpPost, @@ -130,8 +127,7 @@ public static List GetApiDefinitions() { "principle", "Certify.Models.Hub.SecurityPrinciple" } } }, - new GeneratedAPI { - + new() { OperationName = "UpdateSecurityPrincipleAssignedRoles", OperationMethod = HttpPost, Comment = "Update assigned roles for a security principle", @@ -143,8 +139,7 @@ public static List GetApiDefinitions() { "update", "Certify.Models.Hub.SecurityPrincipleAssignedRoleUpdate" } } }, - new GeneratedAPI { - + new() { OperationName = "RemoveSecurityPrinciple", OperationMethod = HttpDelete, Comment = "Remove security principle", @@ -154,8 +149,7 @@ public static List GetApiDefinitions() ReturnType = "Models.Config.ActionResult", Params = new Dictionary{{"id","string"}} }, - new GeneratedAPI { - + new() { OperationName = "GetManagedChallenges", OperationMethod = HttpGet, Comment = "Get list of available managed challenges (DNS challenge delegation etc)", @@ -165,9 +159,7 @@ public static List GetApiDefinitions() ReturnType = "ICollection", RequiredPermissions = [new ("managedchallenge", "managedchallenge_list")] }, - - new GeneratedAPI { - + new() { OperationName = "UpdateManagedChallenge", OperationMethod = HttpPost, Comment = "Add/update a managed challenge (DNS challenge delegation etc)", @@ -180,9 +172,7 @@ public static List GetApiDefinitions() }, RequiredPermissions = [new ("managedchallenge", "managedchallenge_update")] }, - - new GeneratedAPI { - + new() { OperationName = "RemoveManagedChallenge", OperationMethod = HttpDelete, Comment = "Delete a managed challenge (DNS challenge delegation etc)", @@ -195,12 +185,11 @@ public static List GetApiDefinitions() }, RequiredPermissions = [new ("managedchallenge", "managedchallenge_delete")] }, - new GeneratedAPI { - + new() { OperationName = "PerformManagedChallenge", OperationMethod = HttpPost, Comment = "Perform a managed challenge (DNS challenge delegation etc)", - PublicAPIController=null, // skip public controller implementation + PublicAPIController = null, // skip public controller implementation ServiceAPIRoute = "managedchallenge/request", ReturnType = "Models.Config.ActionResult", Params = new Dictionary{ @@ -208,12 +197,11 @@ public static List GetApiDefinitions() }, RequiredPermissions = [new ("managedchallenge", "managedchallenge_request")] }, - new GeneratedAPI { - + new() { OperationName = "CleanupManagedChallenge", OperationMethod = HttpPost, Comment = "Perform cleanup for a previously managed challenge (DNS challenge delegation etc)", - PublicAPIController=null, // skip public controller implementation + PublicAPIController = null, // skip public controller implementation ServiceAPIRoute = "managedchallenge/cleanup", ReturnType = "Models.Config.ActionResult", Params = new Dictionary{ @@ -221,7 +209,7 @@ public static List GetApiDefinitions() } }, /* per instance API, via management hub */ - new GeneratedAPI { + new() { OperationName = "GetAcmeAccounts", OperationMethod = HttpGet, Comment = "Get All Acme Accounts", @@ -229,9 +217,9 @@ public static List GetApiDefinitions() PublicAPIController = "CertificateAuthority", PublicAPIRoute = "{instanceId}/accounts/", ReturnType = "ICollection", - Params =new Dictionary{ { "instanceId", "string" } } + Params = new Dictionary { { "instanceId", "string" } } }, - new GeneratedAPI { + new() { OperationName = "AddAcmeAccount", OperationMethod = HttpPost, Comment = "Add New Acme Account", @@ -239,9 +227,9 @@ public static List GetApiDefinitions() PublicAPIController = "CertificateAuthority", PublicAPIRoute = "{instanceId}/account/", ReturnType = "Models.Config.ActionResult", - Params =new Dictionary{ { "instanceId", "string" },{ "registration", "Certify.Models.ContactRegistration" } } + Params = new Dictionary { { "instanceId", "string" }, { "registration", "Certify.Models.ContactRegistration" } } }, - new GeneratedAPI { + new() { OperationName = "GetCertificateAuthorities", OperationMethod = HttpGet, Comment = "Get list of defined Certificate Authorities", @@ -249,9 +237,9 @@ public static List GetApiDefinitions() PublicAPIController = "CertificateAuthority", PublicAPIRoute = "{instanceId}/authority", ReturnType = "ICollection", - Params =new Dictionary{ { "instanceId", "string" } } + Params = new Dictionary { { "instanceId", "string" } } }, - new GeneratedAPI { + new() { OperationName = "UpdateCertificateAuthority", OperationMethod = HttpPost, Comment = "Add/Update Certificate Authority", @@ -259,9 +247,9 @@ public static List GetApiDefinitions() PublicAPIController = "CertificateAuthority", PublicAPIRoute = "{instanceId}/authority", ReturnType = "Models.Config.ActionResult", - Params =new Dictionary{ { "instanceId", "string" }, { "ca", "Certify.Models.CertificateAuthority" } } + Params = new Dictionary { { "instanceId", "string" }, { "ca", "Certify.Models.CertificateAuthority" } } }, - new GeneratedAPI { + new() { OperationName = "RemoveCertificateAuthority", OperationMethod = HttpDelete, Comment = "Remove Certificate Authority", @@ -269,9 +257,9 @@ public static List GetApiDefinitions() PublicAPIController = "CertificateAuthority", PublicAPIRoute = "{instanceId}/authority/{id}", ReturnType = "Models.Config.ActionResult", - Params =new Dictionary{ { "instanceId", "string" },{ "id", "string" } } + Params = new Dictionary { { "instanceId", "string" }, { "id", "string" } } }, - new GeneratedAPI { + new() { OperationName = "RemoveAcmeAccount", OperationMethod = HttpDelete, Comment = "Remove ACME Account", @@ -279,19 +267,19 @@ public static List GetApiDefinitions() PublicAPIController = "CertificateAuthority", PublicAPIRoute = "{instanceId}/accounts/{storageKey}/{deactivate}", ReturnType = "Models.Config.ActionResult", - Params =new Dictionary{ { "instanceId", "string" }, { "storageKey", "string" }, { "deactivate", "bool" } } - }, - new GeneratedAPI { - OperationName = "GetStoredCredentials", - OperationMethod = HttpGet, - Comment = "Get List of Stored Credentials", - UseManagementAPI = true, - PublicAPIController = "StoredCredential", - PublicAPIRoute = "{instanceId}", - ReturnType = "ICollection", - Params =new Dictionary{ { "instanceId", "string" } } - }, - new GeneratedAPI { + Params = new Dictionary { { "instanceId", "string" }, { "storageKey", "string" }, { "deactivate", "bool" } } + }, + new() { + OperationName = "GetStoredCredentials", + OperationMethod = HttpGet, + Comment = "Get List of Stored Credentials", + UseManagementAPI = true, + PublicAPIController = "StoredCredential", + PublicAPIRoute = "{instanceId}", + ReturnType = "ICollection", + Params = new Dictionary { { "instanceId", "string" } } + }, + new() { OperationName = "UpdateStoredCredential", OperationMethod = HttpPost, Comment = "Add/Update Stored Credential", @@ -299,9 +287,9 @@ public static List GetApiDefinitions() PublicAPIRoute = "{instanceId}", ReturnType = "Models.Config.ActionResult", UseManagementAPI = true, - Params =new Dictionary{ { "instanceId", "string" }, { "item", "Models.Config.StoredCredential" } } + Params = new Dictionary { { "instanceId", "string" }, { "item", "Models.Config.StoredCredential" } } }, - new GeneratedAPI { + new() { OperationName = "RemoveStoredCredential", OperationMethod = HttpDelete, Comment = "Remove Stored Credential", @@ -309,9 +297,9 @@ public static List GetApiDefinitions() PublicAPIController = "StoredCredential", PublicAPIRoute = "{instanceId}/{storageKey}", ReturnType = "Models.Config.ActionResult", - Params =new Dictionary{ { "instanceId", "string" },{ "storageKey", "string" } } + Params = new Dictionary { { "instanceId", "string" }, { "storageKey", "string" } } }, - new GeneratedAPI { + new() { OperationName = "GetDeploymentProviders", OperationMethod = HttpGet, Comment = "Get Deployment Task Providers", @@ -319,24 +307,24 @@ public static List GetApiDefinitions() PublicAPIController = "DeploymentTask", PublicAPIRoute = "{instanceId}", ReturnType = "ICollection", - Params =new Dictionary{ + Params = new Dictionary{ { "instanceId", "string" } } }, - new GeneratedAPI { + new() { OperationName = "GetTargetServiceTypes", OperationMethod = HttpGet, Comment = "Get Service Types present on instance (IIS, nginx etc)", UseManagementAPI = true, - ManagementHubCommandType = Models.Hub.ManagementHubCommands.GetTargetServiceTypes, + ManagementHubCommandType = Models.Hub.ManagementHubCommands.GetTargetServiceTypes, PublicAPIController = "Target", PublicAPIRoute = "{instanceId}/types", ReturnType = "ICollection", - Params =new Dictionary{ + Params = new Dictionary{ { "instanceId", "string" } } }, - new GeneratedAPI { + new() { OperationName = "GetTargetServiceItems", OperationMethod = HttpGet, Comment = "Get Service items (sites) present on instance (IIS, nginx etc).", @@ -345,12 +333,12 @@ public static List GetApiDefinitions() PublicAPIController = "Target", PublicAPIRoute = "{instanceId}/{serviceType}/items", ReturnType = "ICollection", - Params =new Dictionary{ + Params = new Dictionary{ { "instanceId", "string" }, { "serviceType", "string" } } }, - new GeneratedAPI { + new() { OperationName = "GetTargetServiceItemIdentifiers", OperationMethod = HttpGet, Comment = "Get Service item identifiers (domains on a website etc) present on instance (IIS, nginx etc)", @@ -359,13 +347,13 @@ public static List GetApiDefinitions() PublicAPIController = "Target", PublicAPIRoute = "{instanceId}/{serviceType}/item/{itemId}/identifiers", ReturnType = "ICollection", - Params =new Dictionary{ + Params = new Dictionary{ { "instanceId", "string" }, { "serviceType", "string" }, { "itemId", "string" } } }, - new GeneratedAPI { + new() { OperationName = "GetChallengeProviders", OperationMethod = HttpGet, Comment = "Get Dns Challenge Providers", @@ -373,25 +361,25 @@ public static List GetApiDefinitions() PublicAPIController = "ChallengeProvider", PublicAPIRoute = "{instanceId}", ReturnType = "ICollection", - Params =new Dictionary{ + Params = new Dictionary{ { "instanceId", "string" } } }, - new GeneratedAPI { - OperationName = "GetDnsZones", - OperationMethod = HttpGet, - Comment = "Get List of Zones with the current DNS provider and credential", - UseManagementAPI = true, - PublicAPIController = "ChallengeProvider", - PublicAPIRoute = "{instanceId}/dnszones/{providerTypeId}/{credentialId}", - ReturnType = "ICollection", - Params =new Dictionary{ + new() { + OperationName = "GetDnsZones", + OperationMethod = HttpGet, + Comment = "Get List of Zones with the current DNS provider and credential", + UseManagementAPI = true, + PublicAPIController = "ChallengeProvider", + PublicAPIRoute = "{instanceId}/dnszones/{providerTypeId}/{credentialId}", + ReturnType = "ICollection", + Params = new Dictionary{ { "instanceId", "string" } , { "providerTypeId", "string" }, { "credentialId", "string" } } - }, - new GeneratedAPI { + }, + new() { OperationName = "ExecuteDeploymentTask", OperationMethod = HttpGet, Comment = "Execute Deployment Task", @@ -399,13 +387,13 @@ public static List GetApiDefinitions() PublicAPIController = "DeploymentTask", PublicAPIRoute = "{instanceId}/execute/{managedCertificateId}/{taskId}", ReturnType = "ICollection", - Params =new Dictionary{ + Params = new Dictionary{ { "instanceId", "string" }, { "managedCertificateId", "string" }, { "taskId", "string" } } }, - new GeneratedAPI { + new() { OperationName = "RemoveManagedCertificate", OperationMethod = HttpDelete, Comment = "Remove Managed Certificate", @@ -413,10 +401,10 @@ public static List GetApiDefinitions() PublicAPIController = "Certificate", PublicAPIRoute = "{instanceId}/settings/{managedCertId}", ReturnType = "Models.Config.ActionResult", - Params =new Dictionary{ { "instanceId", "string" },{ "managedCertId", "string" } } + Params = new Dictionary { { "instanceId", "string" }, { "managedCertId", "string" } } }, // TODO - new GeneratedAPI { + new() { OperationName = "PerformExport", OperationMethod = HttpPost, Comment = "Perform an export of all settings", @@ -424,18 +412,18 @@ public static List GetApiDefinitions() PublicAPIRoute = "system/migration/export", ServiceAPIRoute = "system/migration/export", ReturnType = "Models.Config.Migration.ImportExportPackage", - Params =new Dictionary{{ "exportRequest", "Certify.Models.Config.Migration.ExportRequest" } } - }, - new GeneratedAPI { - OperationName = "PerformImport", - OperationMethod = HttpPost, - Comment = "Perform an import of all settings", - PublicAPIController = "System", - PublicAPIRoute = "system/migration/import", - ServiceAPIRoute = "system/migration/import", - ReturnType = "ICollection", - Params =new Dictionary{{ "importRequest", "Certify.Models.Config.Migration.ImportRequest" } } - }, + Params = new Dictionary { { "exportRequest", "Certify.Models.Config.Migration.ExportRequest" } } + }, + new() { + OperationName = "PerformImport", + OperationMethod = HttpPost, + Comment = "Perform an import of all settings", + PublicAPIController = "System", + PublicAPIRoute = "system/migration/import", + ServiceAPIRoute = "system/migration/import", + ReturnType = "ICollection", + Params = new Dictionary { { "importRequest", "Certify.Models.Config.Migration.ImportRequest" } } + }, }; } }