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