public override async Task DeleteSessionAsync(DeleteSessionRequest request, CallSettings callSettings = null) { CheckFailAllRpcs(); await Scheduler.Delay(DeleteSessionDelay); int count = Interlocked.Increment(ref _deletionCounter); }
public void ExecuteSql() { Session session; { CreateSessionRequest request = new CreateSessionRequest { Database = DatabaseUrl }; session = client.CreateSession(request); Assert.IsNotNull(session); AssertAffinityCount(1); } { ExecuteSqlRequest request = new ExecuteSqlRequest { Session = session.Name, Sql = string.Format("select id, data from {0}", TableName) }; ResultSet resultSet = client.ExecuteSql(request); AssertAffinityCount(1); Assert.IsNotNull(resultSet); Assert.AreEqual(1, resultSet.Rows.Count); Assert.AreEqual(ColumnId, resultSet.Rows[0].Values[0].StringValue); } { DeleteSessionRequest request = new DeleteSessionRequest { Name = session.Name }; client.DeleteSession(request); AssertAffinityCount(0); } }
/// <summary> /// Deletes a session identified by the session ID. /// </summary> /// <param name="request">The request object containing the details to send. Required.</param> /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param> /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param> /// <returns>A response object containing details about the completed operation</returns> /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/bastion/DeleteSession.cs.html">here</a> to see an example of how to use DeleteSession API.</example> public async Task <DeleteSessionResponse> DeleteSession(DeleteSessionRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called deleteSession"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/sessions/{sessionId}".Trim('/'))); HttpMethod method = new HttpMethod("DELETE"); HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request); requestMessage.Headers.Add("Accept", "application/json"); GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration); HttpResponseMessage responseMessage; try { if (retryingClient != null) { responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false); } else { responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false); } this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage); return(Converter.FromHttpResponseMessage <DeleteSessionResponse>(responseMessage)); } catch (Exception e) { logger.Error($"DeleteSession failed with error: {e.Message}"); throw; } }
protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIBastionSession", "Remove")) { return; } DeleteSessionRequest request; try { request = new DeleteSessionRequest { SessionId = SessionId, IfMatch = IfMatch, OpcRequestId = OpcRequestId }; response = client.DeleteSession(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public DeleteSessionTest() { _mediator = new Mock <IMediator>(); _id = Guid.NewGuid(); _repositorySession = SessionRepositoryBuilder.Instance().Find(_id).Build(); _command = new DeleteSessionRequest(_id); }
public ActionResult <DeleteSessionResponse> Delete([FromBody] DeleteSessionRequest request) { request.CommanderID = User.GetUserId(); var result = _sessionService.Delete(request); return(result); }
/* * Delete Current Session */ public static void EndSession(Spanner.SpannerClient client, Session session) { DeleteSessionRequest deleteSessionRequest = new DeleteSessionRequest(); deleteSessionRequest.Name = session.Name; client.DeleteSession(deleteSessionRequest); return; }
/// <summary> /// Removes session information for a specified bot, alias, and user ID. /// /// /// <para> /// You can use this operation to restart a conversation with a bot. When you remove a /// session, the entire history of the session is removed so that you can start again. /// </para> /// /// <para> /// You don't need to delete a session. Sessions have a time limit and will expire. Set /// the session time limit when you create the bot. The default is 5 minutes, but you /// can specify anything between 1 minute and 24 hours. /// </para> /// /// <para> /// If you specify a bot or alias ID that doesn't exist, you receive a <code>BadRequestException.</code> /// /// </para> /// /// <para> /// If the locale doesn't exist in the bot, or if the locale hasn't been enables for the /// alias, you receive a <code>BadRequestException</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteSession 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 DeleteSession service method, as returned by LexRuntimeV2.</returns> /// <exception cref="Amazon.LexRuntimeV2.Model.AccessDeniedException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ConflictException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.InternalServerException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ResourceNotFoundException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ThrottlingException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ValidationException"> /// /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/DeleteSession">REST API Reference for DeleteSession Operation</seealso> public virtual Task <DeleteSessionResponse> DeleteSessionAsync(DeleteSessionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteSessionRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteSessionResponseUnmarshaller.Instance; return(InvokeAsync <DeleteSessionResponse>(request, options, cancellationToken)); }
/// <summary> /// Removes session information for a specified bot, alias, and user ID. /// /// /// <para> /// You can use this operation to restart a conversation with a bot. When you remove a /// session, the entire history of the session is removed so that you can start again. /// </para> /// /// <para> /// You don't need to delete a session. Sessions have a time limit and will expire. Set /// the session time limit when you create the bot. The default is 5 minutes, but you /// can specify anything between 1 minute and 24 hours. /// </para> /// /// <para> /// If you specify a bot or alias ID that doesn't exist, you receive a <code>BadRequestException.</code> /// /// </para> /// /// <para> /// If the locale doesn't exist in the bot, or if the locale hasn't been enables for the /// alias, you receive a <code>BadRequestException</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteSession service method.</param> /// /// <returns>The response from the DeleteSession service method, as returned by LexRuntimeV2.</returns> /// <exception cref="Amazon.LexRuntimeV2.Model.AccessDeniedException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ConflictException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.InternalServerException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ResourceNotFoundException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ThrottlingException"> /// /// </exception> /// <exception cref="Amazon.LexRuntimeV2.Model.ValidationException"> /// /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/DeleteSession">REST API Reference for DeleteSession Operation</seealso> public virtual DeleteSessionResponse DeleteSession(DeleteSessionRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteSessionRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteSessionResponseUnmarshaller.Instance; return(Invoke <DeleteSessionResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the DeleteSession operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteSession operation on AmazonLexRuntimeV2Client.</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 EndDeleteSession /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/DeleteSession">REST API Reference for DeleteSession Operation</seealso> public virtual IAsyncResult BeginDeleteSession(DeleteSessionRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteSessionRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteSessionResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
/// <summary> /// 终结实例节点会话 /// </summary> public DeleteSessionResponse DeleteSession(DeleteSessionRequest deleteSessionRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("node_id", deleteSessionRequest.NodeId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/nodes/{node_id}/session", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", deleteSessionRequest); HttpResponseMessage response = DoHttpRequestSync("POST", request); return(JsonUtils.DeSerializeNull <DeleteSessionResponse>(response)); }
public JsonResult DeleteSession(DeleteSessionRequest model) { var request = $"{AppSettings.Api}deleteSession".PostJsonToUrl( new { apikey = AppSettings.ApiKey, sessionID = model.SessionId }); var responce = JsonConvert.DeserializeObject <DeleteSessionResponce>(request); return(Json(responce)); }
public async Task <IActionResult> DeleteSession(Guid id) { try { var request = new DeleteSessionRequest(id); var response = await _sessionUseCase.Delete(request); return(await ResponseAsync(response)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
/// <summary> /// 删除CC攻击的session设置 /// </summary> /// <param name="req"><see cref="DeleteSessionRequest"/></param> /// <returns><see cref="DeleteSessionResponse"/></returns> public DeleteSessionResponse DeleteSessionSync(DeleteSessionRequest req) { JsonResponseModel <DeleteSessionResponse> rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteSession"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteSessionResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
/// <summary>Snippet for DeleteSession</summary> public void DeleteSession_RequestObject() { // Snippet: DeleteSession(DeleteSessionRequest,CallSettings) // Create client SpannerClient spannerClient = SpannerClient.Create(); // Initialize request argument(s) DeleteSessionRequest request = new DeleteSessionRequest { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; // Make the request spannerClient.DeleteSession(request); // End snippet }
public void DeleteSession2() { Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict); DeleteSessionRequest request = new DeleteSessionRequest { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteSession(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); SpannerClient client = new SpannerClientImpl(mockGrpcClient.Object, null); client.DeleteSession(request); mockGrpcClient.VerifyAll(); }
public async Task DeleteSessionAsync2() { Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict); DeleteSessionRequest request = new DeleteSessionRequest { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteSessionAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); SpannerClient client = new SpannerClientImpl(mockGrpcClient.Object, null); await client.DeleteSessionAsync(request); mockGrpcClient.VerifyAll(); }
public void BoundUnbindInvalidAffinityKey() { GetSessionRequest getSessionRequest = new GetSessionRequest { Name = "random_name" }; Assert.ThrowsException <RpcException>(() => client.GetSession(getSessionRequest)); DeleteSessionRequest deleteSessionRequest = new DeleteSessionRequest { Name = "random_name" }; Assert.ThrowsException <RpcException>(() => client.DeleteSession(deleteSessionRequest)); }
public async Task DeleteSessionAsync_RequestObject() { // Snippet: DeleteSessionAsync(DeleteSessionRequest,CallSettings) // Create client SpannerClient spannerClient = await SpannerClient.CreateAsync(); // Initialize request argument(s) DeleteSessionRequest request = new DeleteSessionRequest { Name = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").ToString(), }; // Make the request await spannerClient.DeleteSessionAsync(request); // End snippet }
public void DeleteSession() { if (_sessionId == Guid.Empty) { return; } var request = new DeleteSessionRequest(); var response = Post <DeleteSessionRequest, DeleteSessionResponse>(request); if (!response.IsValid()) { throw new Exception("Could not delete session: Invalid response"); } _sessionId = Guid.Empty; }
public void CreateListDeleteSession() { Session session; { CreateSessionRequest request = new CreateSessionRequest { Database = DatabaseUrl }; session = client.CreateSession(request); Assert.IsNotNull(session); AssertAffinityCount(1); } { ListSessionsRequest request = new ListSessionsRequest { Database = DatabaseUrl }; ListSessionsResponse response = client.ListSessions(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Sessions); Assert.IsTrue(response.Sessions.Any(item => item.Name == session.Name)); AssertAffinityCount(1); } { DeleteSessionRequest request = new DeleteSessionRequest { Name = session.Name }; client.DeleteSession(request); AssertAffinityCount(0); } { ListSessionsRequest request = new ListSessionsRequest { Database = DatabaseUrl }; ListSessionsResponse response = client.ListSessions(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Sessions); Assert.IsFalse(response.Sessions.Any(item => item.Name == session.Name)); AssertAffinityCount(0); } }
/* * Probes to test session related grpc call from Spanner stub. * * Includes tests against CreateSession, GetSession, ListSessions, and * DeleteSession of Spanner stub. * * Args: * stub: An object of SpannerStub. * metrics: A list of metrics. * */ public static void sessionManagement(Spanner.SpannerClient client, ref Dictionary <string, long> metrics) { long latency; CreateSessionRequest createSessionRequest = new CreateSessionRequest(); createSessionRequest.Database = _DATABASE; //Create Session test //Create stopwatch.Start(); Session session = client.CreateSession(createSessionRequest); stopwatch.Stop(); latency = stopwatch.ElapsedMilliseconds; metrics.Add("create_session_latency_ms", latency); //Get Session GetSessionRequest getSessionRequest = new GetSessionRequest(); getSessionRequest.Name = session.Name; stopwatch.Start(); client.GetSession(getSessionRequest); stopwatch.Stop(); latency = stopwatch.ElapsedMilliseconds; metrics.Add("get_session_latency_ms", latency); //List Session ListSessionsRequest listSessionsRequest = new ListSessionsRequest(); listSessionsRequest.Database = _DATABASE; stopwatch.Start(); client.ListSessions(listSessionsRequest); stopwatch.Stop(); latency = stopwatch.ElapsedMilliseconds; metrics.Add("list_sessions_latency_ms", latency); //Delete Session DeleteSessionRequest deleteSessionRequest = new DeleteSessionRequest(); deleteSessionRequest.Name = session.Name; stopwatch.Start(); client.DeleteSession(deleteSessionRequest); stopwatch.Stop(); latency = stopwatch.ElapsedMilliseconds; metrics.Add("delete_session_latency_ms", latency); }
public void BoundAfterUnbind() { CreateSessionRequest request = new CreateSessionRequest { Database = DatabaseUrl }; Session session = client.CreateSession(request); Assert.AreEqual(1, invoker.GetChannelRefsByAffinityKeyForTest().Count); DeleteSessionRequest deleteSessionRequest = new DeleteSessionRequest { Name = session.Name }; client.DeleteSession(deleteSessionRequest); Assert.AreEqual(0, invoker.GetChannelRefsByAffinityKeyForTest().Count); GetSessionRequest getSessionRequest = new GetSessionRequest(); getSessionRequest.Name = session.Name; Assert.ThrowsException <Grpc.Core.RpcException>(() => client.GetSession(getSessionRequest)); }
/// <summary> /// Delete a test session. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task DeleteSessionAsync(DeleteSessionRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Delete a test session. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task DeleteSessionAsync(DeleteSessionRequest request, st::CancellationToken cancellationToken) => DeleteSessionAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
partial void Modify_DeleteSessionRequest(ref DeleteSessionRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Delete a test session. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override void DeleteSession(DeleteSessionRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_DeleteSessionRequest(ref request, ref callSettings); _callDeleteSession.Sync(request, callSettings); }
/// <summary> /// Delete a test session. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task DeleteSessionAsync(DeleteSessionRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_DeleteSessionRequest(ref request, ref callSettings); return(_callDeleteSession.Async(request, callSettings)); }
public async Task <Response> Delete(DeleteSessionRequest deleteSessionRequest) { var responseSession = await _mediator.Send(deleteSessionRequest, CancellationToken.None); return(responseSession); }
public virtual Task <DeleteSessionResponse> DeleteAsync(DeleteSessionRequest request) => Client.SendAsync <DeleteSessionResponse>(request);