private void HandleOutput(LaunchInstanceConfigurationRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case StatusParamSet: response = client.Waiters.ForLaunchInstanceConfiguration(request, waiterConfig, WaitForStatus).Execute(); break; case Default: response = client.LaunchInstanceConfiguration(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Instance); }
protected override void ProcessRecord() { base.ProcessRecord(); LaunchInstanceConfigurationRequest request; try { request = new LaunchInstanceConfigurationRequest { InstanceConfigurationId = InstanceConfigurationId, InstanceConfiguration = InstanceConfiguration, OpcRetryToken = OpcRetryToken }; 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 <LaunchInstanceConfigurationRequest, LaunchInstanceConfigurationResponse> ForLaunchInstanceConfiguration(LaunchInstanceConfigurationRequest request, WaiterConfiguration config, params WorkrequestsService.Models.WorkRequest.StatusEnum[] targetStates) { return(new Waiter <LaunchInstanceConfigurationRequest, LaunchInstanceConfigurationResponse>(() => { var response = client.LaunchInstanceConfiguration(request).Result; var getWorkRequestRequest = new Oci.WorkrequestsService.Requests.GetWorkRequestRequest { WorkRequestId = response.OpcWorkRequestId }; workRequestClient.Waiters.ForWorkRequest(getWorkRequestRequest, config, targetStates).Execute(); return response; })); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="statuses">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 <LaunchInstanceConfigurationRequest, LaunchInstanceConfigurationResponse> ForLaunchInstanceConfiguration(LaunchInstanceConfigurationRequest request, params WorkrequestsService.Models.WorkRequest.StatusEnum[] targetStates) { return(this.ForLaunchInstanceConfiguration(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }