Esempio n. 1
0
 private Amazon.WorkSpaces.Model.ModifySelfservicePermissionsResponse CallAWSServiceOperation(IAmazonWorkSpaces client, Amazon.WorkSpaces.Model.ModifySelfservicePermissionsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon WorkSpaces", "ModifySelfservicePermissions");
     try
     {
         #if DESKTOP
         return(client.ModifySelfservicePermissions(request));
         #elif CORECLR
         return(client.ModifySelfservicePermissionsAsync(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;
     }
 }
Esempio n. 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);
        }