public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.WorkSpaces.Model.ModifyClientPropertiesRequest();


            // populate ClientProperties
            var requestClientPropertiesIsNull = true;

            request.ClientProperties = new Amazon.WorkSpaces.Model.ClientProperties();
            Amazon.WorkSpaces.ReconnectEnum requestClientProperties_clientProperties_ReconnectEnabled = null;
            if (cmdletContext.ClientProperties_ReconnectEnabled != null)
            {
                requestClientProperties_clientProperties_ReconnectEnabled = cmdletContext.ClientProperties_ReconnectEnabled;
            }
            if (requestClientProperties_clientProperties_ReconnectEnabled != null)
            {
                request.ClientProperties.ReconnectEnabled = requestClientProperties_clientProperties_ReconnectEnabled;
                requestClientPropertiesIsNull             = false;
            }
            // determine if request.ClientProperties should be set to null
            if (requestClientPropertiesIsNull)
            {
                request.ClientProperties = null;
            }
            if (cmdletContext.ResourceId != null)
            {
                request.ResourceId = cmdletContext.ResourceId;
            }

            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);
        }
Exemple #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.WorkSpaces.Model.ModifySelfservicePermissionsRequest();

            if (cmdletContext.ResourceId != null)
            {
                request.ResourceId = cmdletContext.ResourceId;
            }

            // populate SelfservicePermissions
            var requestSelfservicePermissionsIsNull = true;

            request.SelfservicePermissions = new Amazon.WorkSpaces.Model.SelfservicePermissions();
            Amazon.WorkSpaces.ReconnectEnum requestSelfservicePermissions_selfservicePermissions_ChangeComputeType = null;
            if (cmdletContext.SelfservicePermissions_ChangeComputeType != null)
            {
                requestSelfservicePermissions_selfservicePermissions_ChangeComputeType = cmdletContext.SelfservicePermissions_ChangeComputeType;
            }
            if (requestSelfservicePermissions_selfservicePermissions_ChangeComputeType != null)
            {
                request.SelfservicePermissions.ChangeComputeType = requestSelfservicePermissions_selfservicePermissions_ChangeComputeType;
                requestSelfservicePermissionsIsNull = false;
            }
            Amazon.WorkSpaces.ReconnectEnum requestSelfservicePermissions_selfservicePermissions_IncreaseVolumeSize = null;
            if (cmdletContext.SelfservicePermissions_IncreaseVolumeSize != null)
            {
                requestSelfservicePermissions_selfservicePermissions_IncreaseVolumeSize = cmdletContext.SelfservicePermissions_IncreaseVolumeSize;
            }
            if (requestSelfservicePermissions_selfservicePermissions_IncreaseVolumeSize != null)
            {
                request.SelfservicePermissions.IncreaseVolumeSize = requestSelfservicePermissions_selfservicePermissions_IncreaseVolumeSize;
                requestSelfservicePermissionsIsNull = false;
            }
            Amazon.WorkSpaces.ReconnectEnum requestSelfservicePermissions_selfservicePermissions_RebuildWorkspace = null;
            if (cmdletContext.SelfservicePermissions_RebuildWorkspace != null)
            {
                requestSelfservicePermissions_selfservicePermissions_RebuildWorkspace = cmdletContext.SelfservicePermissions_RebuildWorkspace;
            }
            if (requestSelfservicePermissions_selfservicePermissions_RebuildWorkspace != null)
            {
                request.SelfservicePermissions.RebuildWorkspace = requestSelfservicePermissions_selfservicePermissions_RebuildWorkspace;
                requestSelfservicePermissionsIsNull             = false;
            }
            Amazon.WorkSpaces.ReconnectEnum requestSelfservicePermissions_selfservicePermissions_RestartWorkspace = null;
            if (cmdletContext.SelfservicePermissions_RestartWorkspace != null)
            {
                requestSelfservicePermissions_selfservicePermissions_RestartWorkspace = cmdletContext.SelfservicePermissions_RestartWorkspace;
            }
            if (requestSelfservicePermissions_selfservicePermissions_RestartWorkspace != null)
            {
                request.SelfservicePermissions.RestartWorkspace = requestSelfservicePermissions_selfservicePermissions_RestartWorkspace;
                requestSelfservicePermissionsIsNull             = false;
            }
            Amazon.WorkSpaces.ReconnectEnum requestSelfservicePermissions_selfservicePermissions_SwitchRunningMode = null;
            if (cmdletContext.SelfservicePermissions_SwitchRunningMode != null)
            {
                requestSelfservicePermissions_selfservicePermissions_SwitchRunningMode = cmdletContext.SelfservicePermissions_SwitchRunningMode;
            }
            if (requestSelfservicePermissions_selfservicePermissions_SwitchRunningMode != null)
            {
                request.SelfservicePermissions.SwitchRunningMode = requestSelfservicePermissions_selfservicePermissions_SwitchRunningMode;
                requestSelfservicePermissionsIsNull = false;
            }
            // determine if request.SelfservicePermissions should be set to null
            if (requestSelfservicePermissionsIsNull)
            {
                request.SelfservicePermissions = 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);
        }