private Amazon.EC2.Model.ModifyFpgaImageAttributeResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.ModifyFpgaImageAttributeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "ModifyFpgaImageAttribute");
     try
     {
         #if DESKTOP
         return(client.ModifyFpgaImageAttribute(request));
         #elif CORECLR
         return(client.ModifyFpgaImageAttributeAsync(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.EC2.Model.ModifyFpgaImageAttributeRequest();

            if (cmdletContext.Attribute != null)
            {
                request.Attribute = cmdletContext.Attribute;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.FpgaImageId != null)
            {
                request.FpgaImageId = cmdletContext.FpgaImageId;
            }

            // populate LoadPermission
            var requestLoadPermissionIsNull = true;

            request.LoadPermission = new Amazon.EC2.Model.LoadPermissionModifications();
            List <Amazon.EC2.Model.LoadPermissionRequest> requestLoadPermission_loadPermission_Add = null;

            if (cmdletContext.LoadPermission_Add != null)
            {
                requestLoadPermission_loadPermission_Add = cmdletContext.LoadPermission_Add;
            }
            if (requestLoadPermission_loadPermission_Add != null)
            {
                request.LoadPermission.Add  = requestLoadPermission_loadPermission_Add;
                requestLoadPermissionIsNull = false;
            }
            List <Amazon.EC2.Model.LoadPermissionRequest> requestLoadPermission_loadPermission_Remove = null;

            if (cmdletContext.LoadPermission_Remove != null)
            {
                requestLoadPermission_loadPermission_Remove = cmdletContext.LoadPermission_Remove;
            }
            if (requestLoadPermission_loadPermission_Remove != null)
            {
                request.LoadPermission.Remove = requestLoadPermission_loadPermission_Remove;
                requestLoadPermissionIsNull   = false;
            }
            // determine if request.LoadPermission should be set to null
            if (requestLoadPermissionIsNull)
            {
                request.LoadPermission = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.OperationType != null)
            {
                request.OperationType = cmdletContext.OperationType;
            }
            if (cmdletContext.ProductCode != null)
            {
                request.ProductCodes = cmdletContext.ProductCode;
            }
            if (cmdletContext.UserGroup != null)
            {
                request.UserGroups = cmdletContext.UserGroup;
            }
            if (cmdletContext.UserId != null)
            {
                request.UserIds = cmdletContext.UserId;
            }

            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);
        }