/// <summary> /// Shows the metadata for the specified console history. See CaptureConsoleHistory for details about using the console history operations. /// </summary> /// <param name="param"></param> /// <returns></returns> public async Task <GetConsoleHistoryResponse> GetConsoleHistory(GetConsoleHistoryRequest param) { var uri = new Uri($"{GetEndPoint(CoreServices.InstanceConsoleHistory, this.Region)}/{param.InstanceConsoleHistoryId}"); using (var webResponse = await this.RestClientAsync.Get(uri)) using (var stream = webResponse.GetResponseStream()) using (var reader = new StreamReader(stream)) { var response = await reader.ReadToEndAsync(); return(new GetConsoleHistoryResponse() { ConsoleHistory = this.JsonSerializer.Deserialize <ConsoleHistory>(response), ETag = webResponse.Headers.Get("etag"), OpcRequestId = webResponse.Headers.Get("opc-request-id") }); } }
private void HandleOutput(GetConsoleHistoryRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForConsoleHistory(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetConsoleHistory(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.ConsoleHistory); }
protected override void ProcessRecord() { base.ProcessRecord(); GetConsoleHistoryRequest request; try { request = new GetConsoleHistoryRequest { InstanceConsoleHistoryId = InstanceConsoleHistoryId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <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 <GetConsoleHistoryRequest, GetConsoleHistoryResponse> ForConsoleHistory(GetConsoleHistoryRequest request, WaiterConfiguration config, params ConsoleHistory.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetConsoleHistoryRequest, GetConsoleHistoryResponse>( request, request => client.GetConsoleHistory(request), response => targetStates.Contains(response.ConsoleHistory.LifecycleState.Value) ); return(new Waiter <GetConsoleHistoryRequest, GetConsoleHistoryResponse>(config, agent)); }
/// <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 <GetConsoleHistoryRequest, GetConsoleHistoryResponse> ForConsoleHistory(GetConsoleHistoryRequest request, params ConsoleHistory.LifecycleStateEnum[] targetStates) { return(this.ForConsoleHistory(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }