Skip to content

Commit

Permalink
refactor/perf: apply lint suggestions (G-Research#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw authored Aug 31, 2023
1 parent 16419e9 commit f6a8038
Show file tree
Hide file tree
Showing 42 changed files with 397 additions and 429 deletions.
32 changes: 16 additions & 16 deletions Consul/ACL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private class ACLCreationResult
/// <param name="acl">The ACL entry to create</param>
/// <returns>A write result containing the newly created ACL token</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<WriteResult<string>> Create(ACLEntry acl, CancellationToken ct = default(CancellationToken))
public Task<WriteResult<string>> Create(ACLEntry acl, CancellationToken ct = default)
{
return Create(acl, WriteOptions.Default, ct);
}
Expand All @@ -216,7 +216,7 @@ private class ACLCreationResult
/// <param name="q">Customized write options</param>
/// <returns>A write result containing the newly created ACL token</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public async Task<WriteResult<string>> Create(ACLEntry acl, WriteOptions q, CancellationToken ct = default(CancellationToken))
public async Task<WriteResult<string>> Create(ACLEntry acl, WriteOptions q, CancellationToken ct = default)
{
var res = await _client.Put<ACLEntry, ACLCreationResult>("/v1/acl/create", acl, q).Execute(ct).ConfigureAwait(false);
return new WriteResult<string>(res, res.Response.ID);
Expand All @@ -228,7 +228,7 @@ private class ACLCreationResult
/// <param name="acl">The ACL entry to update</param>
/// <returns>An empty write result</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<WriteResult> Update(ACLEntry acl, CancellationToken ct = default(CancellationToken))
public Task<WriteResult> Update(ACLEntry acl, CancellationToken ct = default)
{
return Update(acl, WriteOptions.Default, ct);
}
Expand All @@ -240,7 +240,7 @@ private class ACLCreationResult
/// <param name="q">Customized write options</param>
/// <returns>An empty write result</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<WriteResult> Update(ACLEntry acl, WriteOptions q, CancellationToken ct = default(CancellationToken))
public Task<WriteResult> Update(ACLEntry acl, WriteOptions q, CancellationToken ct = default)
{
return _client.Put("/v1/acl/update", acl, q).Execute(ct);
}
Expand All @@ -251,7 +251,7 @@ private class ACLCreationResult
/// <param name="id">The ACL ID to destroy</param>
/// <returns>An empty write result</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<WriteResult<bool>> Destroy(string id, CancellationToken ct = default(CancellationToken))
public Task<WriteResult<bool>> Destroy(string id, CancellationToken ct = default)
{
return Destroy(id, WriteOptions.Default, ct);
}
Expand All @@ -263,7 +263,7 @@ private class ACLCreationResult
/// <param name="q">Customized write options</param>
/// <returns>An empty write result</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<WriteResult<bool>> Destroy(string id, WriteOptions q, CancellationToken ct = default(CancellationToken))
public Task<WriteResult<bool>> Destroy(string id, WriteOptions q, CancellationToken ct = default)
{
return _client.PutReturning<bool>(string.Format("/v1/acl/destroy/{0}", id), q).Execute(ct);
}
Expand All @@ -274,7 +274,7 @@ private class ACLCreationResult
/// <param name="id">The ACL ID to clone</param>
/// <returns>A write result containing the newly created ACL token</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<WriteResult<string>> Clone(string id, CancellationToken ct = default(CancellationToken))
public Task<WriteResult<string>> Clone(string id, CancellationToken ct = default)
{
return Clone(id, WriteOptions.Default, ct);
}
Expand All @@ -286,7 +286,7 @@ private class ACLCreationResult
/// <param name="q">Customized write options</param>
/// <returns>A write result containing the newly created ACL token</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public async Task<WriteResult<string>> Clone(string id, WriteOptions q, CancellationToken ct = default(CancellationToken))
public async Task<WriteResult<string>> Clone(string id, WriteOptions q, CancellationToken ct = default)
{
var res = await _client.PutReturning<ACLCreationResult>(string.Format("/v1/acl/clone/{0}", id), q).Execute(ct).ConfigureAwait(false);
return new WriteResult<string>(res, res.Response.ID);
Expand All @@ -298,7 +298,7 @@ private class ACLCreationResult
/// <param name="id">The ACL ID to request information about</param>
/// <returns>A query result containing the ACL entry matching the provided ID, or a query result with a null response if no token matched the provided ID</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<QueryResult<ACLEntry>> Info(string id, CancellationToken ct = default(CancellationToken))
public Task<QueryResult<ACLEntry>> Info(string id, CancellationToken ct = default)
{
return Info(id, QueryOptions.Default, ct);
}
Expand All @@ -311,7 +311,7 @@ private class ACLCreationResult
/// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A query result containing the ACL entry matching the provided ID, or a query result with a null response if no token matched the provided ID</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public async Task<QueryResult<ACLEntry>> Info(string id, QueryOptions q, CancellationToken ct = default(CancellationToken))
public async Task<QueryResult<ACLEntry>> Info(string id, QueryOptions q, CancellationToken ct = default)
{
var res = await _client.Get<ACLEntry[]>(string.Format("/v1/acl/info/{0}", id), q).Execute(ct).ConfigureAwait(false);
return new QueryResult<ACLEntry>(res, res.Response != null && res.Response.Length > 0 ? res.Response[0] : null);
Expand All @@ -322,7 +322,7 @@ private class ACLCreationResult
/// </summary>
/// <returns>A write result containing the list of all ACLs</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<QueryResult<ACLEntry[]>> List(CancellationToken ct = default(CancellationToken))
public Task<QueryResult<ACLEntry[]>> List(CancellationToken ct = default)
{
return List(QueryOptions.Default, ct);
}
Expand All @@ -334,7 +334,7 @@ private class ACLCreationResult
/// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A write result containing the list of all ACLs</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<QueryResult<ACLEntry[]>> List(QueryOptions q, CancellationToken ct = default(CancellationToken))
public Task<QueryResult<ACLEntry[]>> List(QueryOptions q, CancellationToken ct = default)
{
return _client.Get<ACLEntry[]>("/v1/acl/list", q).Execute(ct);
}
Expand All @@ -346,7 +346,7 @@ private class ACLCreationResult
/// <param name="ct">>Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A string containing the translated rule(s)</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<WriteResult<string>> TranslateRules(string rules, CancellationToken ct = default(CancellationToken))
public Task<WriteResult<string>> TranslateRules(string rules, CancellationToken ct = default)
{
return TranslateRules(rules, WriteOptions.Default, ct);
}
Expand All @@ -359,7 +359,7 @@ private class ACLCreationResult
/// <param name="ct">>Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A string containing the translated rule(s)</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public async Task<WriteResult<string>> TranslateRules(string rules, WriteOptions q, CancellationToken ct = default(CancellationToken))
public async Task<WriteResult<string>> TranslateRules(string rules, WriteOptions q, CancellationToken ct = default)
{

var res = await _client.Post($"/v1/acl/rules/translate", rules, q).Execute(ct).ConfigureAwait(false);
Expand All @@ -373,7 +373,7 @@ private class ACLCreationResult
/// <param name="ct">>Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A string containing the translated rule(s)</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public Task<QueryResult<string>> TranslateLegacyTokenRules(string id, CancellationToken ct = default(CancellationToken))
public Task<QueryResult<string>> TranslateLegacyTokenRules(string id, CancellationToken ct = default)
{
return TranslateLegacyTokenRules(id, QueryOptions.Default, ct);
}
Expand All @@ -386,7 +386,7 @@ private class ACLCreationResult
/// <param name="ct">>Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A string containing the translated rule(s)</returns>
[Obsolete("The Legacy ACL system has been deprecated, please use Token, Role and Policy instead.")]
public async Task<QueryResult<string>> TranslateLegacyTokenRules(string id, QueryOptions q, CancellationToken ct = default(CancellationToken))
public async Task<QueryResult<string>> TranslateLegacyTokenRules(string id, QueryOptions q, CancellationToken ct = default)
{
var res = await _client.Get($"/v1/acl/rules/translate/{id}", q).Execute(ct).ConfigureAwait(false);
return new QueryResult<string>(res, res.Response);
Expand Down
4 changes: 2 additions & 2 deletions Consul/ACLReplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal ACLReplication(ConsulClient c)
/// </summary>
/// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A query result with details of the ACL Replication system in Consul</returns>
public Task<QueryResult<ACLReplicationEntry>> Status(CancellationToken ct = default(CancellationToken))
public Task<QueryResult<ACLReplicationEntry>> Status(CancellationToken ct = default)
{
return Status(QueryOptions.Default, ct);
}
Expand All @@ -102,7 +102,7 @@ internal ACLReplication(ConsulClient c)
/// <param name="queryOptions">Any query options for the request</param>
/// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>A query result with details of the ACL Replication system in Consul</returns>
public async Task<QueryResult<ACLReplicationEntry>> Status(QueryOptions queryOptions, CancellationToken ct = default(CancellationToken))
public async Task<QueryResult<ACLReplicationEntry>> Status(QueryOptions queryOptions, CancellationToken ct = default)
{
var res = await _client.Get<ACLReplicationEntry>("/v1/acl/replication", queryOptions).Execute(ct).ConfigureAwait(false);
return new QueryResult<ACLReplicationEntry>(res, res.Response);
Expand Down
Loading

0 comments on commit f6a8038

Please sign in to comment.