Skip to content

Commit

Permalink
Cleaned up all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Soulard committed Dec 13, 2021
1 parent 8d2ac93 commit 7e97936
Show file tree
Hide file tree
Showing 31 changed files with 209 additions and 48 deletions.
14 changes: 0 additions & 14 deletions src/Enclave.Sdk/Clients/AuthorityClient.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Enclave.Sdk/Clients/ClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected ClientBase(HttpClient httpClient)
/// <param name="data">the object to encode.</param>
/// <returns>String content of object.</returns>
/// <exception cref="ArgumentNullException">throws if data provided is null.</exception>
protected StringContent CreateJsonContent<TModel>(TModel data)
protected static StringContent CreateJsonContent<TModel>(TModel data)
{
if (data is null)
{
Expand All @@ -51,7 +51,7 @@ protected StringContent CreateJsonContent<TModel>(TModel data)
/// <typeparam name="TModel">the object type to deserialise to.</typeparam>
/// <param name="httpContent">httpContent from the API call.</param>
/// <returns>the object of type specified.</returns>
protected async Task<TModel?> DeserialiseAsync<TModel>(HttpContent httpContent)
protected static async Task<TModel?> DeserialiseAsync<TModel>(HttpContent httpContent)
{
if (httpContent is null)
{
Expand Down
5 changes: 0 additions & 5 deletions src/Enclave.Sdk/Clients/Interfaces/IAuthorityClient.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Enclave.Sdk/Clients/Interfaces/IDnsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Task<PaginatedResponseModel<DnsRecordSummary>> GetRecordsAsync(
/// <summary>
/// Create a DNS Record using a <see cref="DnsRecordCreate"/> model.
/// </summary>
/// <param name="createModel">The model needed to create a DNS Record</param>
/// <param name="createModel">The model needed to create a DNS Record.</param>
/// <returns>The created DNS Record as <see cref="DnsRecordCreate"/>.</returns>
Task<DnsRecord> CreateRecordAsync(DnsRecordCreate createModel);

Expand All @@ -92,7 +92,7 @@ Task<PaginatedResponseModel<DnsRecordSummary>> GetRecordsAsync(
/// Get a detailed DNS Record.
/// </summary>
/// <param name="dnsRecordId">The id of the DNS Record you want to get.</param>
/// <returns>A detailed DNS Record object</returns>
/// <returns>A detailed DNS Record object.</returns>
Task<DnsRecord> GetRecordAsync(DnsRecordId dnsRecordId);

/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions src/Enclave.Sdk/Clients/Interfaces/IOrganisationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ public interface IOrganisationClient
/// </summary>
AccountOrganisation Organisation { get; }

/// <summary>
/// An instance of <see cref="AuthorityClient"/> associated with the current organisaiton.
/// </summary>
IAuthorityClient Authority { get; }

/// <summary>
/// An instance of <see cref="DnsClient"/> associated with the current organisaiton.
/// </summary>
Expand Down
15 changes: 7 additions & 8 deletions src/Enclave.Sdk/Clients/OrganisationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,26 @@ 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);
}

/// <inheritdoc/>
public AccountOrganisation Organisation { get; }

/// <inheritdoc/>
public IAuthorityClient Authority => throw new NotImplementedException();

/// <inheritdoc/>
public IDnsClient Dns { get; }

/// <inheritdoc/>
public IEnrolmentKeysClient EnrolmentKeys { get; }

/// <inheritdoc/>
public ILogsClient Logs => throw new NotImplementedException();
public ILogsClient Logs { get; }

/// <inheritdoc/>
public IPoliciesClient Policies { get; }
Expand All @@ -53,7 +52,7 @@ public OrganisationClient(HttpClient httpClient, AccountOrganisation currentOrga
public IEnrolledSystemsClient EnrolledSystems { get; }

/// <inheritdoc/>
public ITagsClient Tags => throw new NotImplementedException();
public ITagsClient Tags { get; }

/// <inheritdoc/>
public IUnapprovedSystemsClient UnapprovedSystems { get; }
Expand Down
1 change: 0 additions & 1 deletion src/Enclave.Sdk/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public static JsonSerializerOptions JsonSerializerOptions
{
get
{

var options = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Expand Down
10 changes: 10 additions & 0 deletions src/Enclave.Sdk/Data/Account/UserOrganisationRole.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
namespace Enclave.Sdk.Api.Data.Account;

/// <summary>
/// The User roles.
/// </summary>
public enum UserOrganisationRole
{
/// <summary>
/// The owner of the organisation.
/// </summary>
Owner,

/// <summary>
/// An Admin of the organisaiton.
/// </summary>
Admin,
}
1 change: 0 additions & 1 deletion src/Enclave.Sdk/Data/Dns/DnsRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Enclave.Sdk.Api.Data.Dns;
/// </summary>
public class DnsRecord
{

/// <summary>
/// The ID of the record.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Enclave.Sdk/Data/Dns/DnsRecordId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Enclave.Sdk.Api.Data.Dns;

/// <summary>
/// An int backed Dns Record Id.
/// </summary>
[TypedId(IdBackingType.Int)]
public readonly partial struct DnsRecordId
{
Expand Down
3 changes: 3 additions & 0 deletions src/Enclave.Sdk/Data/Dns/DnsZoneId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Enclave.Sdk.Api.Data.Dns;

/// <summary>
/// An int backed Dns Zone Id.
/// </summary>
[TypedId(IdBackingType.Int)]
public readonly partial struct DnsZoneId
{
Expand Down
18 changes: 18 additions & 0 deletions src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemQuerySortMode.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
namespace Enclave.Sdk.Api.Data.EnrolledSystems.Enum;

/// <summary>
/// System Query Sort order used when making a System request.
/// </summary>
public enum SystemQuerySortMode
{
/// <summary>
/// Sort by recently enrolled.
/// </summary>
RecentlyEnrolled,

/// <summary>
/// Sort by recently connected.
/// </summary>
RecentlyConnected,

/// <summary>
/// Sort by description.
/// </summary>
Description,

/// <summary>
/// Sort by enrolment key.
/// </summary>
EnrolmentKeyUsed,
}
12 changes: 12 additions & 0 deletions src/Enclave.Sdk/Data/EnrolledSystems/Enum/SystemType.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
namespace Enclave.Sdk.Api.Data.EnrolledSystems.Enum;

/// <summary>
/// Defines the types of Systems.
/// </summary>
public enum SystemType
{
/// <summary>
/// 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.
/// </summary>
GeneralPurpose,

/// <summary>
/// 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.
/// </summary>
Ephemeral,
}
3 changes: 3 additions & 0 deletions src/Enclave.Sdk/Data/EnrolmentKeys/EnrolmentKeyId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Enclave.Sdk.Api.Data.EnrolmentKeys;

/// <summary>
/// An int backed Enrolment Key Id.
/// </summary>
[TypedId(IdBackingType.Int)]
public partial struct EnrolmentKeyId
{
Expand Down
10 changes: 10 additions & 0 deletions src/Enclave.Sdk/Data/EnrolmentKeys/Enum/ApprovalMode.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
namespace Enclave.Sdk.Api.Data.EnrolmentKeys.Enum;

/// <summary>
/// System Approval Mode.
/// </summary>
public enum ApprovalMode
{
/// <summary>
/// Automatically approve systems.
/// </summary>
Automatic,

/// <summary>
/// Manually approve systems.
/// </summary>
Manual,
}
18 changes: 18 additions & 0 deletions src/Enclave.Sdk/Data/EnrolmentKeys/Enum/EnrolmentKeySortOrder.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
namespace Enclave.Sdk.Api.Data.EnrolmentKeys.Enum;

/// <summary>
/// Enrolment Key Sort Order used when making an Enrolment Key request.
/// </summary>
public enum EnrolmentKeySortOrder
{
/// <summary>
/// Sort by Description.
/// </summary>
Description,

/// <summary>
/// Sort by Last Used.
/// </summary>
LastUsed,

/// <summary>
/// Sort By Approval Mode.
/// </summary>
ApprovalMode,

/// <summary>
/// Sort by Uses Remaining.
/// </summary>
UsesRemaining,
}
14 changes: 14 additions & 0 deletions src/Enclave.Sdk/Data/Logging/Enum/ActivityLogLevel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
namespace Enclave.Sdk.Api.Data.Logging.Enum;

/// <summary>
/// Log Error Type.
/// </summary>
public enum ActivityLogLevel
{
/// <summary>
/// Information log level.
/// </summary>
Information,

/// <summary>
/// Warning Log.
/// </summary>
Warning,

/// <summary>
/// Error Log.
/// </summary>
Error,
}
14 changes: 14 additions & 0 deletions src/Enclave.Sdk/Data/Organisations/Enum/OrganisationPlan.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
namespace Enclave.Sdk.Api.Data.Organisations.Enum;

/// <summary>
/// An Enum describing the types of plan.
/// </summary>
public enum OrganisationPlan
{
/// <summary>
/// Starter Organisation Plan.
/// </summary>
Starter = 0,

/// <summary>
/// Pro Organisaiton Plan.
/// </summary>
Pro = 1,

/// <summary>
/// Business Organisaiton Plan.
/// </summary>
Business = 2,
}
6 changes: 6 additions & 0 deletions src/Enclave.Sdk/Data/Organisations/OrganisationUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ public class OrganisationUser
public UserOrganisationRole Role { get; init; }
}

/// <summary>
/// Top Level model for organisation user requests.
/// </summary>
public class OrganisationUsersTopLevel
{
/// <summary>
/// A list of Organisation Users.
/// </summary>
public IReadOnlyList<OrganisationUser>? Users { get; init; }
}
6 changes: 3 additions & 3 deletions src/Enclave.Sdk/Data/Pagination/PaginatedResponseModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public class PaginatedResponseModel<TItemType>
/// <summary>
/// Metadata for the paginated data.
/// </summary>
public PaginationMetadata Metadata { get; init; }
public PaginationMetadata Metadata { get; init; } = default!;

/// <summary>
/// The related links for the current page of data.
/// </summary>
public PaginationLinks Links { get; init; }
public PaginationLinks Links { get; init; } = default!;

/// <summary>
/// The requested page of items.
/// </summary>
public IEnumerable<TItemType> Items { get; init; }
public IEnumerable<TItemType> Items { get; init; } = default!;
}
4 changes: 2 additions & 2 deletions src/Enclave.Sdk/Data/Pagination/PaginationLinks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class PaginationLinks
/// <summary>
/// The first page of data.
/// </summary>
public Uri First { get; init; }
public Uri? First { get; init; }

/// <summary>
/// The previous page of data (or null if this is the first page).
Expand All @@ -23,5 +23,5 @@ public class PaginationLinks
/// <summary>
/// The last page of data.
/// </summary>
public Uri Last { get; init; }
public Uri? Last { get; init; }
}
4 changes: 4 additions & 0 deletions src/Enclave.Sdk/Data/PatchModel/IPatchModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
namespace Enclave.Sdk.Api.Data.PatchModel;

/// <summary>
/// An interface for use with a PatchBuilder.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "Useful for using PatchBuilder")]
public interface IPatchModel
{
}
Loading

0 comments on commit 7e97936

Please sign in to comment.