public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.EnableVolumeIORequest(); if (cmdletContext.VolumeId != null) { request.VolumeId = cmdletContext.VolumeId; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
/// <summary> /// Initiates the asynchronous execution of the EnableVolumeIO operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the EnableVolumeIO operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<EnableVolumeIOResponse> EnableVolumeIOAsync(EnableVolumeIORequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new EnableVolumeIORequestMarshaller(); var unmarshaller = EnableVolumeIOResponseUnmarshaller.Instance; return InvokeAsync<EnableVolumeIORequest,EnableVolumeIOResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Enables I/O operations for a volume that had I/O operations disabled because the data /// on the volume was potentially inconsistent. /// </summary> /// <param name="request">Container for the necessary parameters to execute the EnableVolumeIO service method.</param> /// /// <returns>The response from the EnableVolumeIO service method, as returned by EC2.</returns> public EnableVolumeIOResponse EnableVolumeIO(EnableVolumeIORequest request) { var marshaller = new EnableVolumeIORequestMarshaller(); var unmarshaller = EnableVolumeIOResponseUnmarshaller.Instance; return Invoke<EnableVolumeIORequest,EnableVolumeIOResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the EnableVolumeIO operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the EnableVolumeIO operation on AmazonEC2Client.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndEnableVolumeIO /// operation.</returns> public IAsyncResult BeginEnableVolumeIO(EnableVolumeIORequest request, AsyncCallback callback, object state) { var marshaller = new EnableVolumeIORequestMarshaller(); var unmarshaller = EnableVolumeIOResponseUnmarshaller.Instance; return BeginInvoke<EnableVolumeIORequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeEnableVolumeIO(EnableVolumeIORequest enableVolumeIORequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new EnableVolumeIORequestMarshaller().Marshall(enableVolumeIORequest); var unmarshaller = EnableVolumeIOResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the EnableVolumeIO operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.EnableVolumeIO"/> /// </summary> /// /// <param name="enableVolumeIORequest">Container for the necessary parameters to execute the EnableVolumeIO operation on AmazonEC2.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> public IAsyncResult BeginEnableVolumeIO(EnableVolumeIORequest enableVolumeIORequest, AsyncCallback callback, object state) { return invokeEnableVolumeIO(enableVolumeIORequest, callback, state, false); }
/// <summary> /// <para>Enables I/O operations for a volume that had I/O operations disabled because the data on the volume was potentially /// inconsistent.</para> /// </summary> /// /// <param name="enableVolumeIORequest">Container for the necessary parameters to execute the EnableVolumeIO service method on /// AmazonEC2.</param> /// public EnableVolumeIOResponse EnableVolumeIO(EnableVolumeIORequest enableVolumeIORequest) { IAsyncResult asyncResult = invokeEnableVolumeIO(enableVolumeIORequest, null, null, true); return EndEnableVolumeIO(asyncResult); }
/// <summary> /// <para>Enables I/O operations for a volume that had I/O operations disabled because the data on the volume was potentially /// inconsistent.</para> /// </summary> /// /// <param name="enableVolumeIORequest">Container for the necessary parameters to execute the EnableVolumeIO service method on /// AmazonEC2.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<EnableVolumeIOResponse> EnableVolumeIOAsync(EnableVolumeIORequest enableVolumeIORequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new EnableVolumeIORequestMarshaller(); var unmarshaller = EnableVolumeIOResponseUnmarshaller.GetInstance(); return Invoke<IRequest, EnableVolumeIORequest, EnableVolumeIOResponse>(enableVolumeIORequest, marshaller, unmarshaller, signer, cancellationToken); }
internal EnableVolumeIOResponse EnableVolumeIO(EnableVolumeIORequest request) { var task = EnableVolumeIOAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the EnableVolumeIO operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.EnableVolumeIO"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the EnableVolumeIO operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public async Task<EnableVolumeIOResponse> EnableVolumeIOAsync(EnableVolumeIORequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new EnableVolumeIORequestMarshaller(); var unmarshaller = EnableVolumeIOResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, EnableVolumeIORequest, EnableVolumeIOResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> Enable IO on the volume after an event has occured. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the EnableVolumeIO service method on /// AmazonEC2.</param> public EnableVolumeIOResponse EnableVolumeIO(EnableVolumeIORequest request) { var task = EnableVolumeIOAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.EC2.Model.EnableVolumeIOResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.EnableVolumeIORequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "EnableVolumeIO"); try { #if DESKTOP return(client.EnableVolumeIO(request)); #elif CORECLR return(client.EnableVolumeIOAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }