/// <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 <GetStackRequest, GetStackResponse> ForStack(GetStackRequest request, WaiterConfiguration config, params Stack.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetStackRequest, GetStackResponse>( request, request => client.GetStack(request), response => targetStates.Contains(response.Stack.LifecycleState.Value), targetStates.Contains(Stack.LifecycleStateEnum.Deleted) ); return(new Waiter <GetStackRequest, GetStackResponse>(config, agent)); }
private void HandleOutput(GetStackRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForStack(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetStack(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Stack); }
protected override void ProcessRecord() { base.ProcessRecord(); GetStackRequest request; try { request = new GetStackRequest { StackId = StackId, 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 <GetStackRequest, GetStackResponse> ForStack(GetStackRequest request, params Stack.LifecycleStateEnum[] targetStates) { return(this.ForStack(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }