public GetSessionResponse GetSession(GetSessionRequest getSessionRequest) { Log(Logger.LogMessageType.Info, "-> -------------------- Comienza la ejecución del método Registration.GetSession", Logger.LoggingLevelType.Medium); GetSessionResponse response = null; try { Log(Logger.LogMessageType.Info, String.Format("Llamando a AgentRegistration.Login con los parametros: User={0}, DeviceType={1}", getSessionRequest.Request.User, getSessionRequest.Request.DeviceType), Logger.LoggingLevelType.Low); LoginResponseInternal loginResponse = AuthenticationProvider.LoginInternal(new LoginRequestInternal() { DeviceType = getSessionRequest.Request.DeviceType, Password = getSessionRequest.Request.Password, User = getSessionRequest.Request.User }); response = new GetSessionResponse() { Response = new GetSessionResponseBody() { ResponseCode = loginResponse.ResponseCode, ResponseMessage = loginResponse.ResponseMessage, SessionID = loginResponse.SessionID, TransactionID = loginResponse.TransactionID } }; Log(Logger.LogMessageType.Info, String.Format("Parametros de respuesta de AgentRegistration.Login: LoginResult={0}, Message={1} ", response.Response.ResponseCode, response.Response.ResponseMessage), Logger.LoggingLevelType.Low); } catch (Exception e) { Log(Logger.LogMessageType.Error, "Excepcion en el metodo Registration.Login: "******"-> -------------------- Termina la ejecución del método Registration.Login", Logger.LoggingLevelType.Medium); return(response); }
public async Task <GetSessionResponse> GetSession(GetSessionRequest request) { var response = new GetSessionResponse(); using (var uow = _uowFactory.GetUnitOfWork()) { var session = await uow.SessionRepo.GetSessionById(new Repositories.DatabaseRepos.SessionRepo.Models.GetSessionByIdRequest() { Id = request.Id }); if (session == null) { response.Notifications.AddError($"Could not find session with Id {request.Id}"); return(response); } if (session.User_Id.HasValue) { var user = await uow.UserRepo.GetUserById(new Repositories.DatabaseRepos.UserRepo.Models.GetUserByIdRequest() { Id = session.User_Id.Value }); response.User = user; } response.Session = session; uow.Commit(); return(response); } }
/// <summary> /// Retrieves a session identified by the session ID. A bastion session lets authorized users connect to a target resource for a predetermined amount of time. /// </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/GetSession.cs.html">here</a> to see an example of how to use GetSession API.</example> public async Task <GetSessionResponse> GetSession(GetSessionRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called getSession"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/sessions/{sessionId}".Trim('/'))); HttpMethod method = new HttpMethod("GET"); 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 <GetSessionResponse>(responseMessage)); } catch (Exception e) { logger.Error($"GetSession failed with error: {e.Message}"); throw; } }
public async Task <GetSessionResponse> GetSession(GetSessionRequest request) { var response = new GetSessionResponse(); using (var uow = _uowFactory.GetUnitOfWork()) { var session = await uow.SessionRepo.GetSessionById(new Infrastructure.Repositories.SessionRepo.Models.GetSessionByIdRequest() { Id = request.Id }); if (session == null) { response.Notifications.AddError($"Could not find session with Id {request.Id}"); return(response); } var logs = await uow.SessionRepo.GetSessionLogsBySessionId(new Infrastructure.Repositories.SessionRepo.Models.GetSessionLogsBySessionIdRequest() { Session_Id = request.Id }); var logEvents = await uow.SessionRepo.GetSessionLogEventsBySessionId(new Infrastructure.Repositories.SessionRepo.Models.GetSessionLogEventsBySessionIdRequest() { Session_Id = request.Id }); if (session.User_Id.HasValue) { var user = await uow.UserRepo.GetUserById(new Infrastructure.Repositories.UserRepo.Models.GetUserByIdRequest() { Id = session.User_Id.Value }); response.User = user; } var eventsLookup = await _cache.SessionEvents(); response.Session = session; response.Logs = logs.Select(l => { var eventIds = logEvents.Where(le => le.Session_Log_Id == l.Id).Select(le => le.Event_Id); return(new SessionLog() { Entity = l, Events = eventsLookup.Where(e => eventIds.Contains(e.Id)).Select(e => new SessionLogEvent() { Event = e, Message = logEvents.FirstOrDefault(le => le.Event_Id == e.Id).Message }).ToList() }); }).ToList(); uow.Commit(); return(response); } }
/// <summary> /// Returns session information for a specified bot, alias, and user. /// /// /// <para> /// For example, you can use this operation to retrieve session information for a user /// that has left a long-running session in use. /// </para> /// /// <para> /// If the bot, alias, or session identifier doesn't exist, Amazon Lex V2 returns a <code>BadRequestException</code>. /// If the locale doesn't exist or is not enabled for the alias, you receive a <code>BadRequestException</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetSession 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 GetSession service method, as returned by LexRuntimeV2.</returns> /// <exception cref="Amazon.LexRuntimeV2.Model.AccessDeniedException"> /// /// </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/GetSession">REST API Reference for GetSession Operation</seealso> public virtual Task <GetSessionResponse> GetSessionAsync(GetSessionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetSessionRequestMarshaller.Instance; options.ResponseUnmarshaller = GetSessionResponseUnmarshaller.Instance; return(InvokeAsync <GetSessionResponse>(request, options, cancellationToken)); }
/// <summary> /// Returns session information for a specified bot, alias, and user. /// /// /// <para> /// For example, you can use this operation to retrieve session information for a user /// that has left a long-running session in use. /// </para> /// /// <para> /// If the bot, alias, or session identifier doesn't exist, Amazon Lex V2 returns a <code>BadRequestException</code>. /// If the locale doesn't exist or is not enabled for the alias, you receive a <code>BadRequestException</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetSession service method.</param> /// /// <returns>The response from the GetSession service method, as returned by LexRuntimeV2.</returns> /// <exception cref="Amazon.LexRuntimeV2.Model.AccessDeniedException"> /// /// </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/GetSession">REST API Reference for GetSession Operation</seealso> public virtual GetSessionResponse GetSession(GetSessionRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetSessionRequestMarshaller.Instance; options.ResponseUnmarshaller = GetSessionResponseUnmarshaller.Instance; return(Invoke <GetSessionResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the GetSession operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSession 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 EndGetSession /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/GetSession">REST API Reference for GetSession Operation</seealso> public virtual IAsyncResult BeginGetSession(GetSessionRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = GetSessionRequestMarshaller.Instance; options.ResponseUnmarshaller = GetSessionResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter<GetSessionRequest, GetSessionResponse> ForSession(GetSessionRequest request, WaiterConfiguration config, params SessionLifecycleState[] targetStates) { var agent = new WaiterAgent<GetSessionRequest, GetSessionResponse>( request, request => client.GetSession(request), response => targetStates.Contains(response.Session.LifecycleState.Value), targetStates.Contains(SessionLifecycleState.Deleted) ); return new Waiter<GetSessionRequest, GetSessionResponse>(config, agent); }
public GetWebRequest(GetSessionRequest request) : this() { AddCookies(request.RequestCookies); if ( request.Form != null ) Form.ReadHtmlFormTag(request.Form); RequestHttpSettings = request.RequestHttpSettings; Url = request.Url.ToString(); ID = GenerateID; }
public override async Task <SessionRequest> GetSessionById(GetSessionRequest request, Grpc.Core.ServerCallContext context) { var data = await _repository.GetSessionAsync(request.ChatId, (models.AuthType) request.AuthType); if (data != null) { context.Status = new Status(StatusCode.OK, $"Session {request.AuthType.ToString()}_{request.ChatId.ToString()} exists"); return(MapToSessionRequest(data)); } return(null); }
public async Task <SessionData> GetSessionDataAsync(Models.AuthType authType, long chatId) { return(await GrpcCallerService.CallService(_urls.Session, async channel => { var client = new SessionClient(channel); var request = new GetSessionRequest { AuthType = GrpcSession.AuthType.Telegram, ChatId = chatId }; var response = await client.GetSessionByIdAsync(request); return MapToSessionData(response); })); }
/// <summary>Snippet for GetSession</summary> public void GetSession_RequestObject() { // Snippet: GetSession(GetSessionRequest,CallSettings) // Create client SpannerClient spannerClient = SpannerClient.Create(); // Initialize request argument(s) GetSessionRequest request = new GetSessionRequest { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; // Make the request Session response = spannerClient.GetSession(request); // End snippet }
public AppendSessionNotification GetSessionInfo(GetSessionRequest request) { var connectionId = Context.ConnectionId; var instance = ListenerManager.GetInstance(); if (instance.IsListener(connectionId)) { var info = instance.GetConnectionInfo(connectionId); var roomInstance = RoomManager.GetInstance(); var room = roomInstance.GetRoomInfo(info.RoomId); return(room?.GetSession(request.Id)?.GetSessionInfo() ?? null); } return(null); }
public CommonApiResponse Get([FromBody] GetSessionRequest request, [FromServices] SessionManagerService sessionManager) { var merchant = (Merchant)HttpContext.Items["Merchant"]; var session = sessionManager.Get(request.SessionId); if (session == null || session.MerchantId != merchant.Id) { throw new OuterException(InnerError.SessionNotFound); } return(new GetSessionResponse { SessionId = session.ExternalId, Amount = session.Amount, Currency = session.Currency }); }
public async Task GetSessionAsync_RequestObject() { // Snippet: GetSessionAsync(GetSessionRequest,CallSettings) // Create client SpannerClient spannerClient = await SpannerClient.CreateAsync(); // Initialize request argument(s) GetSessionRequest request = new GetSessionRequest { Name = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").ToString(), }; // Make the request Session response = await spannerClient.GetSessionAsync(request); // End snippet }
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)); }
/* * 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); }
private void HandleOutput(GetSessionRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForSession(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetSession(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Session); }
public void GetSession2() { Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict); GetSessionRequest request = new GetSessionRequest { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; Session expectedResponse = new Session { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; mockGrpcClient.Setup(x => x.GetSession(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); SpannerClient client = new SpannerClientImpl(mockGrpcClient.Object, null); Session response = client.GetSession(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetSessionAsync2() { Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict); GetSessionRequest request = new GetSessionRequest { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; Session expectedResponse = new Session { SessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"), }; mockGrpcClient.Setup(x => x.GetSessionAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Session>(Task.FromResult(expectedResponse), null, null, null, null)); SpannerClient client = new SpannerClientImpl(mockGrpcClient.Object, null); Session response = await client.GetSessionAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
protected override void ProcessRecord() { base.ProcessRecord(); GetSessionRequest request; try { request = new GetSessionRequest { SessionId = SessionId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
internal static GetSessionResponse GetSession(GetSessionRequest getSessionRequest) { LoginRequestInternal loginRequest = new LoginRequestInternal() { User = getSessionRequest.Request.User, Password = getSessionRequest.Request.Password, DeviceType = getSessionRequest.Request.DeviceType }; LoginResponseInternal loginResponse = AuthenticationProvider.LoginInternal(loginRequest); GetSessionResponse getSessionResponse = new GetSessionResponse(); GetSessionResponseBody getSessionResponseBody = new GetSessionResponseBody() { ResponseCode = loginResponse.ResponseCode, ResponseMessage = loginResponse.ResponseMessage, SessionID = loginResponse.SessionID, TransactionID = loginResponse.TransactionID }; getSessionResponse.Response = getSessionResponseBody; return(getSessionResponse); }
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> /// Gets a testing 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 <Session> GetSessionAsync(GetSessionRequest request, st::CancellationToken cancellationToken) => GetSessionAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
partial void Modify_GetSessionRequest(ref GetSessionRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Gets a testing 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 Session GetSession(GetSessionRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetSessionRequest(ref request, ref callSettings); return(_callGetSession.Sync(request, callSettings)); }
/// <summary> /// Gets a testing 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 virtual Session GetSession(GetSessionRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <remarks/> public void GetSessionAsync(GetSessionRequest GetSessionRequest, object userState) { if ((this.GetSessionOperationCompleted == null)) { this.GetSessionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSessionOperationCompleted); } this.InvokeAsync("GetSession", new object[] { GetSessionRequest}, this.GetSessionOperationCompleted, userState); }
public AppendSessionNotification GetSessionInfo(GetSessionRequest request) { var connectionId = Context.ConnectionId; var instance = ListenerManager.GetInstance(); if (instance.IsListener(connectionId)) { var info = instance.GetConnectionInfo(connectionId); var roomInstance = RoomManager.GetInstance(); var room = roomInstance.GetRoomInfo(info.RoomId); return room?.GetSession(request.Id)?.GetSessionInfo() ?? null; } return null; }
public GetSessionResponse GetSession(GetSessionRequest getSessionRequest) { Log(Logger.LogMessageType.Info, "-> -------------------- Comienza la ejecución del método Movipin.GetSession", Logger.LoggingLevelType.Medium); return(AuthenticationProvider.GetSession(getSessionRequest)); //Log(Logger.LogMessageType.Info, "-> -------------------- Termina la ejecución del método Sales.GetSession", Logger.LoggingLevelType.Medium); }
/// <summary> /// Gets a testing 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 <Session> GetSessionAsync(GetSessionRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Gets a testing 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 <Session> GetSessionAsync(GetSessionRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetSessionRequest(ref request, ref callSettings); return(_callGetSession.Async(request, callSettings)); }
/// <remarks/> public void GetSessionAsync(GetSessionRequest GetSessionRequest) { this.GetSessionAsync(GetSessionRequest, null); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter<GetSessionRequest, GetSessionResponse> ForSession(GetSessionRequest request, params SessionLifecycleState[] targetStates) { return this.ForSession(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates); }