diff --git a/src/Enclave.Sdk/Clients/AuthorityClient.cs b/src/Enclave.Sdk/Clients/AuthorityClient.cs deleted file mode 100644 index ec19132..0000000 --- a/src/Enclave.Sdk/Clients/AuthorityClient.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Enclave.Sdk.Api.Clients.Interfaces; - -namespace Enclave.Sdk.Api.Clients; - -internal class AuthorityClient : ClientBase, IAuthorityClient -{ - private readonly string _orgRoute; - - public AuthorityClient(HttpClient httpClient, string orgRoute) - : base(httpClient) - { - _orgRoute = orgRoute; - } -} diff --git a/src/Enclave.Sdk/Clients/ClientBase.cs b/src/Enclave.Sdk/Clients/ClientBase.cs index 64f5a21..3fafe03 100644 --- a/src/Enclave.Sdk/Clients/ClientBase.cs +++ b/src/Enclave.Sdk/Clients/ClientBase.cs @@ -32,7 +32,7 @@ protected ClientBase(HttpClient httpClient) /// the object to encode. /// String content of object. /// throws if data provided is null. - protected StringContent CreateJsonContent(TModel data) + protected static StringContent CreateJsonContent(TModel data) { if (data is null) { @@ -51,7 +51,7 @@ protected StringContent CreateJsonContent(TModel data) /// the object type to deserialise to. /// httpContent from the API call. /// the object of type specified. - protected async Task DeserialiseAsync(HttpContent httpContent) + protected static async Task DeserialiseAsync(HttpContent httpContent) { if (httpContent is null) { diff --git a/src/Enclave.Sdk/Clients/Interfaces/IAuthorityClient.cs b/src/Enclave.Sdk/Clients/Interfaces/IAuthorityClient.cs deleted file mode 100644 index 49b89d6..0000000 --- a/src/Enclave.Sdk/Clients/Interfaces/IAuthorityClient.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Enclave.Sdk.Api.Clients.Interfaces; - -public interface IAuthorityClient -{ -} \ No newline at end of file diff --git a/src/Enclave.Sdk/Clients/Interfaces/IDnsClient.cs b/src/Enclave.Sdk/Clients/Interfaces/IDnsClient.cs index 0082f1c..ddedbcc 100644 --- a/src/Enclave.Sdk/Clients/Interfaces/IDnsClient.cs +++ b/src/Enclave.Sdk/Clients/Interfaces/IDnsClient.cs @@ -70,7 +70,7 @@ Task> GetRecordsAsync( /// /// Create a DNS Record using a model. /// - /// The model needed to create a DNS Record + /// The model needed to create a DNS Record. /// The created DNS Record as . Task CreateRecordAsync(DnsRecordCreate createModel); @@ -92,7 +92,7 @@ Task> GetRecordsAsync( /// Get a detailed DNS Record. /// /// The id of the DNS Record you want to get. - /// A detailed DNS Record object + /// A detailed DNS Record object. Task GetRecordAsync(DnsRecordId dnsRecordId); /// diff --git a/src/Enclave.Sdk/Clients/Interfaces/IOrganisationClient.cs b/src/Enclave.Sdk/Clients/Interfaces/IOrganisationClient.cs index ee9f6be..5cff80b 100644 --- a/src/Enclave.Sdk/Clients/Interfaces/IOrganisationClient.cs +++ b/src/Enclave.Sdk/Clients/Interfaces/IOrganisationClient.cs @@ -16,11 +16,6 @@ public interface IOrganisationClient /// AccountOrganisation Organisation { get; } - /// - /// An instance of associated with the current organisaiton. - /// - IAuthorityClient Authority { get; } - /// /// An instance of associated with the current organisaiton. /// diff --git a/src/Enclave.Sdk/Clients/OrganisationClient.cs b/src/Enclave.Sdk/Clients/OrganisationClient.cs index 3955e48..2a10d30 100644 --- a/src/Enclave.Sdk/Clients/OrganisationClient.cs +++ b/src/Enclave.Sdk/Clients/OrganisationClient.cs @@ -24,19 +24,18 @@ public OrganisationClient(HttpClient httpClient, AccountOrganisation currentOrga Organisation = currentOrganisation; _orgRoute = $"org/{Organisation.OrgId}"; - EnrolmentKeys = new EnrolmentKeysClient(httpClient, _orgRoute); Dns = new DnsClient(httpClient, _orgRoute); - UnapprovedSystems = new UnapprovedSystemsClient(httpClient, _orgRoute); - EnrolledSystems = new EnrolledSystemsClient(httpClient, _orgRoute); + EnrolmentKeys = new EnrolmentKeysClient(httpClient, _orgRoute); + Logs = new LogsClient(httpClient, _orgRoute); Policies = new PoliciesClient(httpClient, _orgRoute); + EnrolledSystems = new EnrolledSystemsClient(httpClient, _orgRoute); + Tags = new TagsClient(httpClient, _orgRoute); + UnapprovedSystems = new UnapprovedSystemsClient(httpClient, _orgRoute); } /// public AccountOrganisation Organisation { get; } - /// - public IAuthorityClient Authority => throw new NotImplementedException(); - /// public IDnsClient Dns { get; } @@ -44,7 +43,7 @@ public OrganisationClient(HttpClient httpClient, AccountOrganisation currentOrga public IEnrolmentKeysClient EnrolmentKeys { get; } /// - public ILogsClient Logs => throw new NotImplementedException(); + public ILogsClient Logs { get; } /// public IPoliciesClient Policies { get; } @@ -53,7 +52,7 @@ public OrganisationClient(HttpClient httpClient, AccountOrganisation currentOrga public IEnrolledSystemsClient EnrolledSystems { get; } /// - public ITagsClient Tags => throw new NotImplementedException(); + public ITagsClient Tags { get; } /// public IUnapprovedSystemsClient UnapprovedSystems { get; } diff --git a/src/Enclave.Sdk/Constants.cs b/src/Enclave.Sdk/Constants.cs index 38af783..5373998 100644 --- a/src/Enclave.Sdk/Constants.cs +++ b/src/Enclave.Sdk/Constants.cs @@ -9,7 +9,6 @@ public static JsonSerializerOptions JsonSerializerOptions { get { - var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, diff --git a/src/Enclave.Sdk/Data/Account/UserOrganisationRole.cs b/src/Enclave.Sdk/Data/Account/UserOrganisationRole.cs index d5af46d..72fcb83 100644 --- a/src/Enclave.Sdk/Data/Account/UserOrganisationRole.cs +++ b/src/Enclave.Sdk/Data/Account/UserOrganisationRole.cs @@ -1,7 +1,17 @@ namespace Enclave.Sdk.Api.Data.Account; +/// +/// The User roles. +/// public enum UserOrganisationRole { + /// + /// The owner of the organisation. + /// Owner, + + /// + /// An Admin of the organisaiton. + /// Admin, } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/Dns/DnsRecord.cs b/src/Enclave.Sdk/Data/Dns/DnsRecord.cs index cba7800..a07e456 100644 --- a/src/Enclave.Sdk/Data/Dns/DnsRecord.cs +++ b/src/Enclave.Sdk/Data/Dns/DnsRecord.cs @@ -9,7 +9,6 @@ namespace Enclave.Sdk.Api.Data.Dns; /// public class DnsRecord { - /// /// The ID of the record. /// diff --git a/src/Enclave.Sdk/Data/Dns/DnsRecordId.cs b/src/Enclave.Sdk/Data/Dns/DnsRecordId.cs index 0982fb0..12423c4 100644 --- a/src/Enclave.Sdk/Data/Dns/DnsRecordId.cs +++ b/src/Enclave.Sdk/Data/Dns/DnsRecordId.cs @@ -2,6 +2,9 @@ namespace Enclave.Sdk.Api.Data.Dns; +/// +/// An int backed Dns Record Id. +/// [TypedId(IdBackingType.Int)] public readonly partial struct DnsRecordId { diff --git a/src/Enclave.Sdk/Data/Dns/DnsZoneId.cs b/src/Enclave.Sdk/Data/Dns/DnsZoneId.cs index 17694d4..19a491a 100644 --- a/src/Enclave.Sdk/Data/Dns/DnsZoneId.cs +++ b/src/Enclave.Sdk/Data/Dns/DnsZoneId.cs @@ -2,6 +2,9 @@ namespace Enclave.Sdk.Api.Data.Dns; +/// +/// An int backed Dns Zone Id. +/// [TypedId(IdBackingType.Int)] public readonly partial struct DnsZoneId { diff --git a/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemQuerySortMode.cs b/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemQuerySortMode.cs index 60b233f..9864272 100644 --- a/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemQuerySortMode.cs +++ b/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemQuerySortMode.cs @@ -1,9 +1,27 @@ namespace Enclave.Sdk.Api.Data.EnrolledSystems.Enum; +/// +/// System Query Sort order used when making a System request. +/// public enum SystemQuerySortMode { + /// + /// Sort by recently enrolled. + /// RecentlyEnrolled, + + /// + /// Sort by recently connected. + /// RecentlyConnected, + + /// + /// Sort by description. + /// Description, + + /// + /// Sort by enrolment key. + /// EnrolmentKeyUsed, } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemType.cs b/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemType.cs index 8af7fbc..bce91a5 100644 --- a/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemType.cs +++ b/src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemType.cs @@ -1,7 +1,19 @@ namespace Enclave.Sdk.Api.Data.EnrolledSystems.Enum; +/// +/// Defines the types of Systems. +/// public enum SystemType { + /// + /// For workstations, laptops, servers, and other systems that are relatively long-lived or manually provisioned. + /// Systems remain in your Enclave Organisation if they stop running. + /// GeneralPurpose, + + /// + /// For containers, kubernetes pods, and other systems that are temporary, short-lived or automatically provisioned. + /// Systems are automatically removed from your Enclave Organisation when they stop/disconnect. + /// Ephemeral, } diff --git a/src/Enclave.Sdk/Data/EnrolmentKeys/EnrolmentKeyId.cs b/src/Enclave.Sdk/Data/EnrolmentKeys/EnrolmentKeyId.cs index c651970..d26a553 100644 --- a/src/Enclave.Sdk/Data/EnrolmentKeys/EnrolmentKeyId.cs +++ b/src/Enclave.Sdk/Data/EnrolmentKeys/EnrolmentKeyId.cs @@ -2,6 +2,9 @@ namespace Enclave.Sdk.Api.Data.EnrolmentKeys; +/// +/// An int backed Enrolment Key Id. +/// [TypedId(IdBackingType.Int)] public partial struct EnrolmentKeyId { diff --git a/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/ApprovalMode.cs b/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/ApprovalMode.cs index bf1ddad..8c3b64c 100644 --- a/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/ApprovalMode.cs +++ b/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/ApprovalMode.cs @@ -1,7 +1,17 @@ namespace Enclave.Sdk.Api.Data.EnrolmentKeys.Enum; +/// +/// System Approval Mode. +/// public enum ApprovalMode { + /// + /// Automatically approve systems. + /// Automatic, + + /// + /// Manually approve systems. + /// Manual, } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/EnrolmentKeySortOrder.cs b/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/EnrolmentKeySortOrder.cs index 0da202c..fa62bef 100644 --- a/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/EnrolmentKeySortOrder.cs +++ b/src/Enclave.Sdk/Data/EnrolmentKeys/Enum/EnrolmentKeySortOrder.cs @@ -1,9 +1,27 @@ namespace Enclave.Sdk.Api.Data.EnrolmentKeys.Enum; +/// +/// Enrolment Key Sort Order used when making an Enrolment Key request. +/// public enum EnrolmentKeySortOrder { + /// + /// Sort by Description. + /// Description, + + /// + /// Sort by Last Used. + /// LastUsed, + + /// + /// Sort By Approval Mode. + /// ApprovalMode, + + /// + /// Sort by Uses Remaining. + /// UsesRemaining, } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/Logging/Enum/ActivityLogLevel.cs b/src/Enclave.Sdk/Data/Logging/Enum/ActivityLogLevel.cs index 70f0bd2..11b52d6 100644 --- a/src/Enclave.Sdk/Data/Logging/Enum/ActivityLogLevel.cs +++ b/src/Enclave.Sdk/Data/Logging/Enum/ActivityLogLevel.cs @@ -1,8 +1,22 @@ namespace Enclave.Sdk.Api.Data.Logging.Enum; +/// +/// Log Error Type. +/// public enum ActivityLogLevel { + /// + /// Information log level. + /// Information, + + /// + /// Warning Log. + /// Warning, + + /// + /// Error Log. + /// Error, } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/Organisations/Enum/OrganisationPlan.cs b/src/Enclave.Sdk/Data/Organisations/Enum/OrganisationPlan.cs index 8ed8025..c845afa 100644 --- a/src/Enclave.Sdk/Data/Organisations/Enum/OrganisationPlan.cs +++ b/src/Enclave.Sdk/Data/Organisations/Enum/OrganisationPlan.cs @@ -1,8 +1,22 @@ namespace Enclave.Sdk.Api.Data.Organisations.Enum; +/// +/// An Enum describing the types of plan. +/// public enum OrganisationPlan { + /// + /// Starter Organisation Plan. + /// Starter = 0, + + /// + /// Pro Organisaiton Plan. + /// Pro = 1, + + /// + /// Business Organisaiton Plan. + /// Business = 2, } diff --git a/src/Enclave.Sdk/Data/Organisations/OrganisationUser.cs b/src/Enclave.Sdk/Data/Organisations/OrganisationUser.cs index 59b7519..03c2f41 100644 --- a/src/Enclave.Sdk/Data/Organisations/OrganisationUser.cs +++ b/src/Enclave.Sdk/Data/Organisations/OrganisationUser.cs @@ -38,7 +38,13 @@ public class OrganisationUser public UserOrganisationRole Role { get; init; } } +/// +/// Top Level model for organisation user requests. +/// public class OrganisationUsersTopLevel { + /// + /// A list of Organisation Users. + /// public IReadOnlyList? Users { get; init; } } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/Pagination/PaginatedResponseModel.cs b/src/Enclave.Sdk/Data/Pagination/PaginatedResponseModel.cs index 6018bb9..17e9de4 100644 --- a/src/Enclave.Sdk/Data/Pagination/PaginatedResponseModel.cs +++ b/src/Enclave.Sdk/Data/Pagination/PaginatedResponseModel.cs @@ -9,15 +9,15 @@ public class PaginatedResponseModel /// /// Metadata for the paginated data. /// - public PaginationMetadata Metadata { get; init; } + public PaginationMetadata Metadata { get; init; } = default!; /// /// The related links for the current page of data. /// - public PaginationLinks Links { get; init; } + public PaginationLinks Links { get; init; } = default!; /// /// The requested page of items. /// - public IEnumerable Items { get; init; } + public IEnumerable Items { get; init; } = default!; } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/Pagination/PaginationLinks.cs b/src/Enclave.Sdk/Data/Pagination/PaginationLinks.cs index d72c346..4445eae 100644 --- a/src/Enclave.Sdk/Data/Pagination/PaginationLinks.cs +++ b/src/Enclave.Sdk/Data/Pagination/PaginationLinks.cs @@ -8,7 +8,7 @@ public class PaginationLinks /// /// The first page of data. /// - public Uri First { get; init; } + public Uri? First { get; init; } /// /// The previous page of data (or null if this is the first page). @@ -23,5 +23,5 @@ public class PaginationLinks /// /// The last page of data. /// - public Uri Last { get; init; } + public Uri? Last { get; init; } } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/PatchModel/IPatchModel.cs b/src/Enclave.Sdk/Data/PatchModel/IPatchModel.cs index 96e0059..2b3f768 100644 --- a/src/Enclave.Sdk/Data/PatchModel/IPatchModel.cs +++ b/src/Enclave.Sdk/Data/PatchModel/IPatchModel.cs @@ -1,5 +1,9 @@ namespace Enclave.Sdk.Api.Data.PatchModel; +/// +/// An interface for use with a PatchBuilder. +/// +[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "Useful for using PatchBuilder")] public interface IPatchModel { } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/Policies/Enum/PolicyAclProtocol.cs b/src/Enclave.Sdk/Data/Policies/Enum/PolicyAclProtocol.cs index 880fb8a..a4d7bed 100644 --- a/src/Enclave.Sdk/Data/Policies/Enum/PolicyAclProtocol.cs +++ b/src/Enclave.Sdk/Data/Policies/Enum/PolicyAclProtocol.cs @@ -5,8 +5,23 @@ /// public enum PolicyAclProtocol { + /// + /// Any Protocol. + /// Any, + + /// + /// Tcp. + /// Tcp, + + /// + /// Udp. + /// Udp, + + /// + /// Icmp. + /// Icmp, } diff --git a/src/Enclave.Sdk/Data/Policies/Enum/PolicySortOrder.cs b/src/Enclave.Sdk/Data/Policies/Enum/PolicySortOrder.cs index c6ad0d1..c46565d 100644 --- a/src/Enclave.Sdk/Data/Policies/Enum/PolicySortOrder.cs +++ b/src/Enclave.Sdk/Data/Policies/Enum/PolicySortOrder.cs @@ -1,7 +1,17 @@ namespace Enclave.Sdk.Api.Data.Policies.Enum; +/// +/// The sort order when making a Policy Request. +/// public enum PolicySortOrder { + /// + /// Sort by description. + /// Description, + + /// + /// Sort by recently created. + /// RecentlyCreated, } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/Policies/PolicyId.cs b/src/Enclave.Sdk/Data/Policies/PolicyId.cs index ecd7df8..6f8e191 100644 --- a/src/Enclave.Sdk/Data/Policies/PolicyId.cs +++ b/src/Enclave.Sdk/Data/Policies/PolicyId.cs @@ -2,6 +2,9 @@ namespace Enclave.Sdk.Api.Data.Policies; +/// +/// An int backed Policy Id. +/// [TypedId(IdBackingType.Int)] public partial struct PolicyId { diff --git a/src/Enclave.Sdk/Data/SystemId.cs b/src/Enclave.Sdk/Data/SystemId.cs index dafd624..4156752 100644 --- a/src/Enclave.Sdk/Data/SystemId.cs +++ b/src/Enclave.Sdk/Data/SystemId.cs @@ -2,6 +2,9 @@ namespace Enclave.Sdk.Api.Data; +/// +/// A String backed System Id. +/// [TypedId(IdBackingType.String)] public partial struct SystemId { diff --git a/src/Enclave.Sdk/Data/SystemManagement/SystemReference.cs b/src/Enclave.Sdk/Data/SystemManagement/SystemReference.cs index b2eb874..fa24d19 100644 --- a/src/Enclave.Sdk/Data/SystemManagement/SystemReference.cs +++ b/src/Enclave.Sdk/Data/SystemManagement/SystemReference.cs @@ -15,7 +15,7 @@ public class SystemReference /// /// The System ID. /// - public string Id { get; init; } + public string Id { get; init; } = default!; /// /// The local hostname of the system (if known). diff --git a/src/Enclave.Sdk/Data/Tags/TagQuerySortOrder.cs b/src/Enclave.Sdk/Data/Tags/TagQuerySortOrder.cs index d44057f..13c6d99 100644 --- a/src/Enclave.Sdk/Data/Tags/TagQuerySortOrder.cs +++ b/src/Enclave.Sdk/Data/Tags/TagQuerySortOrder.cs @@ -1,8 +1,22 @@ namespace Enclave.Sdk.Api.Data.Tags; +/// +/// The sort order used for a Tag Query. +/// public enum TagQuerySortOrder { + /// + /// Sort Alphabetically. + /// Alphabetical, + + /// + /// Sort by recently used Tags. + /// RecentlyUsed, + + /// + /// Sort by number of Referenced Systems. + /// ReferencedSystems, } \ No newline at end of file diff --git a/src/Enclave.Sdk/Data/UnaprrovedSystems/Enum/SystemType.cs b/src/Enclave.Sdk/Data/UnaprrovedSystems/Enum/SystemType.cs index 9aa78a2..a69868d 100644 --- a/src/Enclave.Sdk/Data/UnaprrovedSystems/Enum/SystemType.cs +++ b/src/Enclave.Sdk/Data/UnaprrovedSystems/Enum/SystemType.cs @@ -1,7 +1,19 @@ namespace Enclave.Sdk.Api.Data.UnaprrovedSystems.Enum; +/// +/// Defines the types of Enrolment Keys. +/// public enum SystemType { + /// + /// For workstations, laptops, servers, and other systems that are relatively long-lived or manually provisioned. + /// Systems remain in your Enclave Organisation if they stop running. + /// GeneralPurpose, + + /// + /// For containers, kubernetes pods, and other systems that are temporary, short-lived or automatically provisioned. + /// Systems are automatically removed from your Enclave Organisation when they stop/disconnect. + /// Ephemeral, } diff --git a/src/Enclave.Sdk/Exceptions/ProblemDetailsException.cs b/src/Enclave.Sdk/Exceptions/ProblemDetailsException.cs index af74bfc..676c931 100644 --- a/src/Enclave.Sdk/Exceptions/ProblemDetailsException.cs +++ b/src/Enclave.Sdk/Exceptions/ProblemDetailsException.cs @@ -1,15 +1,29 @@ namespace Enclave.Sdk.Api.Exceptions; -internal class ProblemDetailsException : Exception +/// +/// An Exception to display the details of an Http Problem Details. +/// +public class ProblemDetailsException : Exception { + /// + /// The Problem Details. + /// public ProblemDetails ProblemDetails { get; } + /// + /// The HttpResponse message. + /// public HttpResponseMessage Response { get; } + /// + /// Constructor for setting up the problem details exception. + /// + /// The problem details from the HTTP response. + /// The HTTP Response message. public ProblemDetailsException(ProblemDetails problemDetails, HttpResponseMessage response) - : base(problemDetails.Title) + : base(problemDetails?.Title) { - ProblemDetails = problemDetails; + ProblemDetails = problemDetails!; Response = response; } } \ No newline at end of file diff --git a/src/Enclave.Sdk/Handlers/ProblemDetailsHttpMessageHandler.cs b/src/Enclave.Sdk/Handlers/ProblemDetailsHttpMessageHandler.cs index 5bbedfb..b063236 100644 --- a/src/Enclave.Sdk/Handlers/ProblemDetailsHttpMessageHandler.cs +++ b/src/Enclave.Sdk/Handlers/ProblemDetailsHttpMessageHandler.cs @@ -7,7 +7,9 @@ internal sealed class ProblemDetailsHttpMessageHandler : DelegatingHandler { public ProblemDetailsHttpMessageHandler() #pragma warning disable CA2000 // Dispose objects before losing scope - : base(new HttpClientHandler()) { } + : base(new HttpClientHandler()) + { + } #pragma warning restore CA2000 // Dispose objects before losing scope protected override async Task SendAsync(HttpRequestMessage request, CancellationToken ct)