private Amazon.WorkSpaces.Model.ModifyWorkspaceCreationPropertiesResponse CallAWSServiceOperation(IAmazonWorkSpaces client, Amazon.WorkSpaces.Model.ModifyWorkspaceCreationPropertiesRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon WorkSpaces", "ModifyWorkspaceCreationProperties"); try { #if DESKTOP return(client.ModifyWorkspaceCreationProperties(request)); #elif CORECLR return(client.ModifyWorkspaceCreationPropertiesAsync(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.ModifyWorkspaceCreationPropertiesRequest(); if (cmdletContext.ResourceId != null) { request.ResourceId = cmdletContext.ResourceId; } // populate WorkspaceCreationProperties var requestWorkspaceCreationPropertiesIsNull = true; request.WorkspaceCreationProperties = new Amazon.WorkSpaces.Model.WorkspaceCreationProperties(); System.String requestWorkspaceCreationProperties_workspaceCreationProperties_CustomSecurityGroupId = null; if (cmdletContext.WorkspaceCreationProperties_CustomSecurityGroupId != null) { requestWorkspaceCreationProperties_workspaceCreationProperties_CustomSecurityGroupId = cmdletContext.WorkspaceCreationProperties_CustomSecurityGroupId; } if (requestWorkspaceCreationProperties_workspaceCreationProperties_CustomSecurityGroupId != null) { request.WorkspaceCreationProperties.CustomSecurityGroupId = requestWorkspaceCreationProperties_workspaceCreationProperties_CustomSecurityGroupId; requestWorkspaceCreationPropertiesIsNull = false; } System.String requestWorkspaceCreationProperties_workspaceCreationProperties_DefaultOu = null; if (cmdletContext.WorkspaceCreationProperties_DefaultOu != null) { requestWorkspaceCreationProperties_workspaceCreationProperties_DefaultOu = cmdletContext.WorkspaceCreationProperties_DefaultOu; } if (requestWorkspaceCreationProperties_workspaceCreationProperties_DefaultOu != null) { request.WorkspaceCreationProperties.DefaultOu = requestWorkspaceCreationProperties_workspaceCreationProperties_DefaultOu; requestWorkspaceCreationPropertiesIsNull = false; } System.Boolean?requestWorkspaceCreationProperties_workspaceCreationProperties_EnableInternetAccess = null; if (cmdletContext.WorkspaceCreationProperties_EnableInternetAccess != null) { requestWorkspaceCreationProperties_workspaceCreationProperties_EnableInternetAccess = cmdletContext.WorkspaceCreationProperties_EnableInternetAccess.Value; } if (requestWorkspaceCreationProperties_workspaceCreationProperties_EnableInternetAccess != null) { request.WorkspaceCreationProperties.EnableInternetAccess = requestWorkspaceCreationProperties_workspaceCreationProperties_EnableInternetAccess.Value; requestWorkspaceCreationPropertiesIsNull = false; } System.Boolean?requestWorkspaceCreationProperties_workspaceCreationProperties_EnableMaintenanceMode = null; if (cmdletContext.WorkspaceCreationProperties_EnableMaintenanceMode != null) { requestWorkspaceCreationProperties_workspaceCreationProperties_EnableMaintenanceMode = cmdletContext.WorkspaceCreationProperties_EnableMaintenanceMode.Value; } if (requestWorkspaceCreationProperties_workspaceCreationProperties_EnableMaintenanceMode != null) { request.WorkspaceCreationProperties.EnableMaintenanceMode = requestWorkspaceCreationProperties_workspaceCreationProperties_EnableMaintenanceMode.Value; requestWorkspaceCreationPropertiesIsNull = false; } System.Boolean?requestWorkspaceCreationProperties_workspaceCreationProperties_EnableWorkDoc = null; if (cmdletContext.WorkspaceCreationProperties_EnableWorkDoc != null) { requestWorkspaceCreationProperties_workspaceCreationProperties_EnableWorkDoc = cmdletContext.WorkspaceCreationProperties_EnableWorkDoc.Value; } if (requestWorkspaceCreationProperties_workspaceCreationProperties_EnableWorkDoc != null) { request.WorkspaceCreationProperties.EnableWorkDocs = requestWorkspaceCreationProperties_workspaceCreationProperties_EnableWorkDoc.Value; requestWorkspaceCreationPropertiesIsNull = false; } System.Boolean?requestWorkspaceCreationProperties_workspaceCreationProperties_UserEnabledAsLocalAdministrator = null; if (cmdletContext.WorkspaceCreationProperties_UserEnabledAsLocalAdministrator != null) { requestWorkspaceCreationProperties_workspaceCreationProperties_UserEnabledAsLocalAdministrator = cmdletContext.WorkspaceCreationProperties_UserEnabledAsLocalAdministrator.Value; } if (requestWorkspaceCreationProperties_workspaceCreationProperties_UserEnabledAsLocalAdministrator != null) { request.WorkspaceCreationProperties.UserEnabledAsLocalAdministrator = requestWorkspaceCreationProperties_workspaceCreationProperties_UserEnabledAsLocalAdministrator.Value; requestWorkspaceCreationPropertiesIsNull = false; } // determine if request.WorkspaceCreationProperties should be set to null if (requestWorkspaceCreationPropertiesIsNull) { request.WorkspaceCreationProperties = 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); }