/// <summary> /// Cancels a query that has been issued. Cancellation is guaranteed only if the query /// has not completed execution before the cancellation request was issued. Because cancellation /// is an idempotent operation, subsequent cancellation requests will return a <code>CancellationMessage</code>, /// indicating that the query has already been canceled. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CancelQuery service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the CancelQuery service method, as returned by TimestreamQuery.</returns> /// <exception cref="Amazon.TimestreamQuery.Model.AccessDeniedException"> /// You are not authorized to perform this action. /// </exception> /// <exception cref="Amazon.TimestreamQuery.Model.InternalServerException"> /// Timestream was unable to fully process this request because of an internal server /// error. /// </exception> /// <exception cref="Amazon.TimestreamQuery.Model.InvalidEndpointException"> /// The requested endpoint was invalid. /// </exception> /// <exception cref="Amazon.TimestreamQuery.Model.ThrottlingException"> /// The request was denied due to request throttling. /// </exception> /// <exception cref="Amazon.TimestreamQuery.Model.ValidationException"> /// Invalid or malformed request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/timestream-query-2018-11-01/CancelQuery">REST API Reference for CancelQuery Operation</seealso> public virtual Task <CancelQueryResponse> CancelQueryAsync(CancelQueryRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = CancelQueryRequestMarshaller.Instance; options.ResponseUnmarshaller = CancelQueryResponseUnmarshaller.Instance; options.EndpointDiscoveryMarshaller = CancelQueryEndpointDiscoveryMarshaller.Instance; options.EndpointOperation = EndpointOperation; return(InvokeAsync <CancelQueryResponse>(request, options, cancellationToken)); }
internal virtual CancelQueryResponse CancelQuery(CancelQueryRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = CancelQueryRequestMarshaller.Instance; options.ResponseUnmarshaller = CancelQueryResponseUnmarshaller.Instance; options.EndpointDiscoveryMarshaller = CancelQueryEndpointDiscoveryMarshaller.Instance; options.EndpointOperation = EndpointOperation; return(Invoke <CancelQueryResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the CancelQuery operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CancelQuery operation on AmazonTimestreamQueryClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCancelQuery /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/timestream-query-2018-11-01/CancelQuery">REST API Reference for CancelQuery Operation</seealso> public virtual IAsyncResult BeginCancelQuery(CancelQueryRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = CancelQueryRequestMarshaller.Instance; options.ResponseUnmarshaller = CancelQueryResponseUnmarshaller.Instance; options.EndpointDiscoveryMarshaller = CancelQueryEndpointDiscoveryMarshaller.Instance; options.EndpointOperation = EndpointOperation; return(BeginInvoke(request, options, callback, state)); }
public HttpRequestMessage BuildCancelQueryRequest(string requestId) { var requestUri = BuildCancelQueryUrl(); var requestBody = new CancelQueryRequest() { RequestId = requestId }; var jsonBody = JsonSerializer.Serialize(requestBody, _jsonSerializerOptions); var request = BuildJsonRequestMessage(requestUri, HttpMethod.Post, jsonBody); return(request); }
public async Task CancelQuery() { Console.WriteLine("Starting query: " + SELECT_ALL_QUERY); QueryRequest queryRequest = new QueryRequest(); queryRequest.QueryString = SELECT_ALL_QUERY; QueryResponse queryResponse = await queryClient.QueryAsync(queryRequest); Console.WriteLine("Cancelling query: " + SELECT_ALL_QUERY); CancelQueryRequest cancelQueryRequest = new CancelQueryRequest(); cancelQueryRequest.QueryId = queryResponse.QueryId; try { await queryClient.CancelQueryAsync(cancelQueryRequest); Console.WriteLine("Query has been successfully cancelled."); } catch (Exception e) { Console.WriteLine("Could not cancel the query: " + SELECT_ALL_QUERY + " = " + e); } }