private Amazon.WorkSpaces.Model.ModifyWorkspacePropertiesResponse CallAWSServiceOperation(IAmazonWorkSpaces client, Amazon.WorkSpaces.Model.ModifyWorkspacePropertiesRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon WorkSpaces", "ModifyWorkspaceProperties"); try { #if DESKTOP return(client.ModifyWorkspaceProperties(request)); #elif CORECLR return(client.ModifyWorkspacePropertiesAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.WorkSpaces.Model.ModifyWorkspacePropertiesRequest(); if (cmdletContext.WorkspaceId != null) { request.WorkspaceId = cmdletContext.WorkspaceId; } // populate WorkspaceProperties var requestWorkspacePropertiesIsNull = true; request.WorkspaceProperties = new Amazon.WorkSpaces.Model.WorkspaceProperties(); Amazon.WorkSpaces.Compute requestWorkspaceProperties_workspaceProperties_ComputeTypeName = null; if (cmdletContext.WorkspaceProperties_ComputeTypeName != null) { requestWorkspaceProperties_workspaceProperties_ComputeTypeName = cmdletContext.WorkspaceProperties_ComputeTypeName; } if (requestWorkspaceProperties_workspaceProperties_ComputeTypeName != null) { request.WorkspaceProperties.ComputeTypeName = requestWorkspaceProperties_workspaceProperties_ComputeTypeName; requestWorkspacePropertiesIsNull = false; } System.Int32?requestWorkspaceProperties_workspaceProperties_RootVolumeSizeGib = null; if (cmdletContext.WorkspaceProperties_RootVolumeSizeGib != null) { requestWorkspaceProperties_workspaceProperties_RootVolumeSizeGib = cmdletContext.WorkspaceProperties_RootVolumeSizeGib.Value; } if (requestWorkspaceProperties_workspaceProperties_RootVolumeSizeGib != null) { request.WorkspaceProperties.RootVolumeSizeGib = requestWorkspaceProperties_workspaceProperties_RootVolumeSizeGib.Value; requestWorkspacePropertiesIsNull = false; } Amazon.WorkSpaces.RunningMode requestWorkspaceProperties_workspaceProperties_RunningMode = null; if (cmdletContext.WorkspaceProperties_RunningMode != null) { requestWorkspaceProperties_workspaceProperties_RunningMode = cmdletContext.WorkspaceProperties_RunningMode; } if (requestWorkspaceProperties_workspaceProperties_RunningMode != null) { request.WorkspaceProperties.RunningMode = requestWorkspaceProperties_workspaceProperties_RunningMode; requestWorkspacePropertiesIsNull = false; } System.Int32?requestWorkspaceProperties_workspaceProperties_RunningModeAutoStopTimeoutInMinute = null; if (cmdletContext.WorkspaceProperties_RunningModeAutoStopTimeoutInMinute != null) { requestWorkspaceProperties_workspaceProperties_RunningModeAutoStopTimeoutInMinute = cmdletContext.WorkspaceProperties_RunningModeAutoStopTimeoutInMinute.Value; } if (requestWorkspaceProperties_workspaceProperties_RunningModeAutoStopTimeoutInMinute != null) { request.WorkspaceProperties.RunningModeAutoStopTimeoutInMinutes = requestWorkspaceProperties_workspaceProperties_RunningModeAutoStopTimeoutInMinute.Value; requestWorkspacePropertiesIsNull = false; } System.Int32?requestWorkspaceProperties_workspaceProperties_UserVolumeSizeGib = null; if (cmdletContext.WorkspaceProperties_UserVolumeSizeGib != null) { requestWorkspaceProperties_workspaceProperties_UserVolumeSizeGib = cmdletContext.WorkspaceProperties_UserVolumeSizeGib.Value; } if (requestWorkspaceProperties_workspaceProperties_UserVolumeSizeGib != null) { request.WorkspaceProperties.UserVolumeSizeGib = requestWorkspaceProperties_workspaceProperties_UserVolumeSizeGib.Value; requestWorkspacePropertiesIsNull = false; } // determine if request.WorkspaceProperties should be set to null if (requestWorkspacePropertiesIsNull) { request.WorkspaceProperties = null; } 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> /// Modifies the WorkSpace properties, including the RunningMode and AutoStop time. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceProperties service method.</param> /// /// <returns>The response from the ModifyWorkspaceProperties service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The specified WorkSpace has an invalid state for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationInProgressException"> /// The properties of this WorkSpace are currently being modified. Try again in a moment. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.UnsupportedWorkspaceConfigurationException"> /// The WorkSpace does not have the supported configuration for this operation. For more /// information, see the <a href="http://docs.aws.amazon.com/workspaces/latest/adminguide">Amazon /// WorkSpaces Administration Guide</a>. /// </exception> public ModifyWorkspacePropertiesResponse ModifyWorkspaceProperties(ModifyWorkspacePropertiesRequest request) { var marshaller = new ModifyWorkspacePropertiesRequestMarshaller(); var unmarshaller = ModifyWorkspacePropertiesResponseUnmarshaller.Instance; return Invoke<ModifyWorkspacePropertiesRequest,ModifyWorkspacePropertiesResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceProperties 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 EndModifyWorkspaceProperties /// operation.</returns> public IAsyncResult BeginModifyWorkspaceProperties(ModifyWorkspacePropertiesRequest request, AsyncCallback callback, object state) { var marshaller = new ModifyWorkspacePropertiesRequestMarshaller(); var unmarshaller = ModifyWorkspacePropertiesResponseUnmarshaller.Instance; return BeginInvoke<ModifyWorkspacePropertiesRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceProperties 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<ModifyWorkspacePropertiesResponse> ModifyWorkspacePropertiesAsync(ModifyWorkspacePropertiesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ModifyWorkspacePropertiesRequestMarshaller(); var unmarshaller = ModifyWorkspacePropertiesResponseUnmarshaller.Instance; return InvokeAsync<ModifyWorkspacePropertiesRequest,ModifyWorkspacePropertiesResponse>(request, marshaller, unmarshaller, cancellationToken); }