Skip to content

Commit

Permalink
Pass ctx for descriptor-based client methods (#7676)
Browse files Browse the repository at this point in the history
Fix applied in the generator to ensure we pass along the cancellation token
to DoRequestAsync.
  • Loading branch information
stevejgordon authored and github-actions[bot] committed May 5, 2023
1 parent c76eb56 commit 7ed5da0
Show file tree
Hide file tree
Showing 11 changed files with 455 additions and 455 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public virtual Task<AsyncSearchStatusResponse> StatusAsync(Elastic.Clients.Elast
{
var descriptor = new AsyncSearchStatusRequestDescriptor(id);
descriptor.BeforeRequest();
return DoRequestAsync<AsyncSearchStatusRequestDescriptor, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor);
return DoRequestAsync<AsyncSearchStatusRequestDescriptor, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -129,7 +129,7 @@ public virtual Task<AsyncSearchStatusResponse> StatusAsync(Elastic.Clients.Elast
public virtual Task<AsyncSearchStatusResponse> StatusAsync(AsyncSearchStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<AsyncSearchStatusRequestDescriptor, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor);
return DoRequestAsync<AsyncSearchStatusRequestDescriptor, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -141,7 +141,7 @@ public virtual Task<AsyncSearchStatusResponse> StatusAsync(Elastic.Clients.Elast
var descriptor = new AsyncSearchStatusRequestDescriptor(id);
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<AsyncSearchStatusRequestDescriptor, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor);
return DoRequestAsync<AsyncSearchStatusRequestDescriptor, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -151,7 +151,7 @@ public virtual Task<AsyncSearchStatusResponse> StatusAsync(Elastic.Clients.Elast
public virtual Task<AsyncSearchStatusResponse> StatusAsync<TDocument>(AsyncSearchStatusRequestDescriptor<TDocument> descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<AsyncSearchStatusRequestDescriptor<TDocument>, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor);
return DoRequestAsync<AsyncSearchStatusRequestDescriptor<TDocument>, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -163,7 +163,7 @@ public virtual Task<AsyncSearchStatusResponse> StatusAsync<TDocument>(Elastic.Cl
var descriptor = new AsyncSearchStatusRequestDescriptor<TDocument>(id);
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<AsyncSearchStatusRequestDescriptor<TDocument>, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor);
return DoRequestAsync<AsyncSearchStatusRequestDescriptor<TDocument>, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand Down Expand Up @@ -249,7 +249,7 @@ public virtual Task<DeleteAsyncSearchResponse> DeleteAsync(Elastic.Clients.Elast
{
var descriptor = new DeleteAsyncSearchRequestDescriptor(id);
descriptor.BeforeRequest();
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -259,7 +259,7 @@ public virtual Task<DeleteAsyncSearchResponse> DeleteAsync(Elastic.Clients.Elast
public virtual Task<DeleteAsyncSearchResponse> DeleteAsync(DeleteAsyncSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -271,7 +271,7 @@ public virtual Task<DeleteAsyncSearchResponse> DeleteAsync(Elastic.Clients.Elast
var descriptor = new DeleteAsyncSearchRequestDescriptor(id);
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -281,7 +281,7 @@ public virtual Task<DeleteAsyncSearchResponse> DeleteAsync(Elastic.Clients.Elast
public virtual Task<DeleteAsyncSearchResponse> DeleteAsync<TDocument>(DeleteAsyncSearchRequestDescriptor<TDocument> descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor<TDocument>, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor<TDocument>, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -293,7 +293,7 @@ public virtual Task<DeleteAsyncSearchResponse> DeleteAsync<TDocument>(Elastic.Cl
var descriptor = new DeleteAsyncSearchRequestDescriptor<TDocument>(id);
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor<TDocument>, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<DeleteAsyncSearchRequestDescriptor<TDocument>, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand Down Expand Up @@ -357,7 +357,7 @@ public virtual Task<GetAsyncSearchResponse<TDocument>> GetAsync<TDocument>(Elast
{
var descriptor = new GetAsyncSearchRequestDescriptor<TDocument>(id);
descriptor.BeforeRequest();
return DoRequestAsync<GetAsyncSearchRequestDescriptor<TDocument>, GetAsyncSearchResponse<TDocument>, GetAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<GetAsyncSearchRequestDescriptor<TDocument>, GetAsyncSearchResponse<TDocument>, GetAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -367,7 +367,7 @@ public virtual Task<GetAsyncSearchResponse<TDocument>> GetAsync<TDocument>(Elast
public virtual Task<GetAsyncSearchResponse<TDocument>> GetAsync<TDocument>(GetAsyncSearchRequestDescriptor<TDocument> descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<GetAsyncSearchRequestDescriptor<TDocument>, GetAsyncSearchResponse<TDocument>, GetAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<GetAsyncSearchRequestDescriptor<TDocument>, GetAsyncSearchResponse<TDocument>, GetAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -379,7 +379,7 @@ public virtual Task<GetAsyncSearchResponse<TDocument>> GetAsync<TDocument>(Elast
var descriptor = new GetAsyncSearchRequestDescriptor<TDocument>(id);
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<GetAsyncSearchRequestDescriptor<TDocument>, GetAsyncSearchResponse<TDocument>, GetAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<GetAsyncSearchRequestDescriptor<TDocument>, GetAsyncSearchResponse<TDocument>, GetAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand Down Expand Up @@ -443,7 +443,7 @@ public virtual Task<SubmitAsyncSearchResponse<TDocument>> SubmitAsync<TDocument>
{
var descriptor = new SubmitAsyncSearchRequestDescriptor<TDocument>();
descriptor.BeforeRequest();
return DoRequestAsync<SubmitAsyncSearchRequestDescriptor<TDocument>, SubmitAsyncSearchResponse<TDocument>, SubmitAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<SubmitAsyncSearchRequestDescriptor<TDocument>, SubmitAsyncSearchResponse<TDocument>, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -453,7 +453,7 @@ public virtual Task<SubmitAsyncSearchResponse<TDocument>> SubmitAsync<TDocument>
public virtual Task<SubmitAsyncSearchResponse<TDocument>> SubmitAsync<TDocument>(SubmitAsyncSearchRequestDescriptor<TDocument> descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<SubmitAsyncSearchRequestDescriptor<TDocument>, SubmitAsyncSearchResponse<TDocument>, SubmitAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<SubmitAsyncSearchRequestDescriptor<TDocument>, SubmitAsyncSearchResponse<TDocument>, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -465,6 +465,6 @@ public virtual Task<SubmitAsyncSearchResponse<TDocument>> SubmitAsync<TDocument>
var descriptor = new SubmitAsyncSearchRequestDescriptor<TDocument>();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<SubmitAsyncSearchRequestDescriptor<TDocument>, SubmitAsyncSearchResponse<TDocument>, SubmitAsyncSearchRequestParameters>(descriptor);
return DoRequestAsync<SubmitAsyncSearchRequestDescriptor<TDocument>, SubmitAsyncSearchResponse<TDocument>, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public virtual Task<AllocationExplainResponse> AllocationExplainAsync(Cancellati
{
var descriptor = new AllocationExplainRequestDescriptor();
descriptor.BeforeRequest();
return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor);
return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -107,7 +107,7 @@ public virtual Task<AllocationExplainResponse> AllocationExplainAsync(Cancellati
public virtual Task<AllocationExplainResponse> AllocationExplainAsync(AllocationExplainRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor);
return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -119,7 +119,7 @@ public virtual Task<AllocationExplainResponse> AllocationExplainAsync(Action<All
var descriptor = new AllocationExplainRequestDescriptor();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor);
return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand Down Expand Up @@ -183,7 +183,7 @@ public virtual Task<ClusterStatsResponse> StatsAsync(CancellationToken cancellat
{
var descriptor = new ClusterStatsRequestDescriptor();
descriptor.BeforeRequest();
return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor);
return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -193,7 +193,7 @@ public virtual Task<ClusterStatsResponse> StatsAsync(CancellationToken cancellat
public virtual Task<ClusterStatsResponse> StatsAsync(ClusterStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor);
return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -205,7 +205,7 @@ public virtual Task<ClusterStatsResponse> StatsAsync(Action<ClusterStatsRequestD
var descriptor = new ClusterStatsRequestDescriptor();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor);
return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand Down Expand Up @@ -269,7 +269,7 @@ public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(CancellationTok
{
var descriptor = new GetClusterSettingsRequestDescriptor();
descriptor.BeforeRequest();
return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor);
return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -279,7 +279,7 @@ public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(CancellationTok
public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(GetClusterSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor);
return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -291,7 +291,7 @@ public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(Action<GetClust
var descriptor = new GetClusterSettingsRequestDescriptor();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor);
return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand Down Expand Up @@ -377,7 +377,7 @@ public virtual Task<HealthResponse> HealthAsync(CancellationToken cancellationTo
{
var descriptor = new HealthRequestDescriptor();
descriptor.BeforeRequest();
return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor);
return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -387,7 +387,7 @@ public virtual Task<HealthResponse> HealthAsync(CancellationToken cancellationTo
public virtual Task<HealthResponse> HealthAsync(HealthRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor);
return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -399,7 +399,7 @@ public virtual Task<HealthResponse> HealthAsync(Action<HealthRequestDescriptor>
var descriptor = new HealthRequestDescriptor();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor);
return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -409,7 +409,7 @@ public virtual Task<HealthResponse> HealthAsync(Action<HealthRequestDescriptor>
public virtual Task<HealthResponse> HealthAsync<TDocument>(HealthRequestDescriptor<TDocument> descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor);
return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -421,7 +421,7 @@ public virtual Task<HealthResponse> HealthAsync<TDocument>(Action<HealthRequestD
var descriptor = new HealthRequestDescriptor<TDocument>();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor);
return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand Down Expand Up @@ -485,7 +485,7 @@ public virtual Task<PendingTasksResponse> PendingTasksAsync(CancellationToken ca
{
var descriptor = new PendingTasksRequestDescriptor();
descriptor.BeforeRequest();
return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor);
return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -495,7 +495,7 @@ public virtual Task<PendingTasksResponse> PendingTasksAsync(CancellationToken ca
public virtual Task<PendingTasksResponse> PendingTasksAsync(PendingTasksRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor);
return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -507,6 +507,6 @@ public virtual Task<PendingTasksResponse> PendingTasksAsync(Action<PendingTasksR
var descriptor = new PendingTasksRequestDescriptor();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor);
return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor, cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public virtual Task<ListDanglingIndicesResponse> ListDanglingIndicesAsync(Cancel
{
var descriptor = new ListDanglingIndicesRequestDescriptor();
descriptor.BeforeRequest();
return DoRequestAsync<ListDanglingIndicesRequestDescriptor, ListDanglingIndicesResponse, ListDanglingIndicesRequestParameters>(descriptor);
return DoRequestAsync<ListDanglingIndicesRequestDescriptor, ListDanglingIndicesResponse, ListDanglingIndicesRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -107,7 +107,7 @@ public virtual Task<ListDanglingIndicesResponse> ListDanglingIndicesAsync(Cancel
public virtual Task<ListDanglingIndicesResponse> ListDanglingIndicesAsync(ListDanglingIndicesRequestDescriptor descriptor, CancellationToken cancellationToken = default)
{
descriptor.BeforeRequest();
return DoRequestAsync<ListDanglingIndicesRequestDescriptor, ListDanglingIndicesResponse, ListDanglingIndicesRequestParameters>(descriptor);
return DoRequestAsync<ListDanglingIndicesRequestDescriptor, ListDanglingIndicesResponse, ListDanglingIndicesRequestParameters>(descriptor, cancellationToken);
}

/// <summary>
Expand All @@ -119,6 +119,6 @@ public virtual Task<ListDanglingIndicesResponse> ListDanglingIndicesAsync(Action
var descriptor = new ListDanglingIndicesRequestDescriptor();
configureRequest?.Invoke(descriptor);
descriptor.BeforeRequest();
return DoRequestAsync<ListDanglingIndicesRequestDescriptor, ListDanglingIndicesResponse, ListDanglingIndicesRequestParameters>(descriptor);
return DoRequestAsync<ListDanglingIndicesRequestDescriptor, ListDanglingIndicesResponse, ListDanglingIndicesRequestParameters>(descriptor, cancellationToken);
}
}

0 comments on commit 7ed5da0

Please sign in to comment.