/// <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 <GetProblemRequest, GetProblemResponse> ForProblem(GetProblemRequest request, WaiterConfiguration config, params ProblemLifecycleState[] targetStates) { var agent = new WaiterAgent <GetProblemRequest, GetProblemResponse>( request, request => client.GetProblem(request), response => targetStates.Contains(response.Problem.LifecycleState.Value) ); return(new Waiter <GetProblemRequest, GetProblemResponse>(config, agent)); }
private void HandleOutput(GetProblemRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForProblem(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetProblem(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Problem); }
protected override void ProcessRecord() { base.ProcessRecord(); GetProblemRequest request; try { request = new GetProblemRequest { ProblemId = ProblemId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <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 <GetProblemRequest, GetProblemResponse> ForProblem(GetProblemRequest request, params ProblemLifecycleState[] targetStates) { return(this.ForProblem(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }