public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.WorkSpaces.Model.RebuildWorkspacesRequest(); if (cmdletContext.Request != null) { request.RebuildWorkspaceRequests = cmdletContext.Request; } 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 RebuildWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RebuildWorkspaces 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<RebuildWorkspacesResponse> RebuildWorkspacesAsync(RebuildWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RebuildWorkspacesRequestMarshaller(); var unmarshaller = RebuildWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<RebuildWorkspacesRequest,RebuildWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Rebuilds the specified WorkSpaces. /// /// /// <para> /// Rebuilding a WorkSpace is a potentially destructive action that can result in the /// loss of data. Rebuilding a WorkSpace causes the following to occur: /// </para> /// <ul> <li>The system is restored to the image of the bundle that the WorkSpace is /// created from. Any applications that have been installed, or system settings that have /// been made since the WorkSpace was created will be lost.</li> <li>The data drive (D /// drive) is re-created from the last automatic snapshot taken of the data drive. The /// current contents of the data drive are overwritten. Automatic snapshots of the data /// drive are taken every 12 hours, so the snapshot can be as much as 12 hours old.</li> /// </ul> /// <para> /// To be able to rebuild a WorkSpace, the WorkSpace must have a <b>State</b> of <code>AVAILABLE</code> /// or <code>ERROR</code>. /// </para> /// <note> /// <para> /// This operation is asynchronous and will return before the WorkSpaces have been completely /// rebuilt. /// </para> /// </note> /// </summary> /// <param name="request">Container for the necessary parameters to execute the RebuildWorkspaces service method.</param> /// /// <returns>The response from the RebuildWorkspaces service method, as returned by WorkSpaces.</returns> public RebuildWorkspacesResponse RebuildWorkspaces(RebuildWorkspacesRequest request) { var marshaller = new RebuildWorkspacesRequestMarshaller(); var unmarshaller = RebuildWorkspacesResponseUnmarshaller.Instance; return Invoke<RebuildWorkspacesRequest,RebuildWorkspacesResponse>(request, marshaller, unmarshaller); }
private Amazon.WorkSpaces.Model.RebuildWorkspacesResponse CallAWSServiceOperation(IAmazonWorkSpaces client, Amazon.WorkSpaces.Model.RebuildWorkspacesRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon WorkSpaces", "RebuildWorkspaces"); try { #if DESKTOP return(client.RebuildWorkspaces(request)); #elif CORECLR return(client.RebuildWorkspacesAsync(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; } }
/// <summary> /// Initiates the asynchronous execution of the RebuildWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RebuildWorkspaces operation on AmazonWorkSpacesClient.</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 EndRebuildWorkspaces /// operation.</returns> public IAsyncResult BeginRebuildWorkspaces(RebuildWorkspacesRequest request, AsyncCallback callback, object state) { var marshaller = new RebuildWorkspacesRequestMarshaller(); var unmarshaller = RebuildWorkspacesResponseUnmarshaller.Instance; return BeginInvoke<RebuildWorkspacesRequest>(request, marshaller, unmarshaller, callback, state); }