private Amazon.SageMaker.Model.CreateAppImageConfigResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateAppImageConfigRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateAppImageConfig");
     try
     {
         #if DESKTOP
         return(client.CreateAppImageConfig(request));
         #elif CORECLR
         return(client.CreateAppImageConfigAsync(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.SageMaker.Model.CreateAppImageConfigRequest();

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

            // populate KernelGatewayImageConfig
            var requestKernelGatewayImageConfigIsNull = true;

            request.KernelGatewayImageConfig = new Amazon.SageMaker.Model.KernelGatewayImageConfig();
            List <Amazon.SageMaker.Model.KernelSpec> requestKernelGatewayImageConfig_kernelGatewayImageConfig_KernelSpec = null;

            if (cmdletContext.KernelGatewayImageConfig_KernelSpec != null)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_KernelSpec = cmdletContext.KernelGatewayImageConfig_KernelSpec;
            }
            if (requestKernelGatewayImageConfig_kernelGatewayImageConfig_KernelSpec != null)
            {
                request.KernelGatewayImageConfig.KernelSpecs = requestKernelGatewayImageConfig_kernelGatewayImageConfig_KernelSpec;
                requestKernelGatewayImageConfigIsNull        = false;
            }
            Amazon.SageMaker.Model.FileSystemConfig requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig = null;

            // populate FileSystemConfig
            var requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfigIsNull = true;

            requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig = new Amazon.SageMaker.Model.FileSystemConfig();
            System.Int32?requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultGid = null;
            if (cmdletContext.FileSystemConfig_DefaultGid != null)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultGid = cmdletContext.FileSystemConfig_DefaultGid.Value;
            }
            if (requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultGid != null)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig.DefaultGid = requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultGid.Value;
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfigIsNull      = false;
            }
            System.Int32?requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultUid = null;
            if (cmdletContext.FileSystemConfig_DefaultUid != null)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultUid = cmdletContext.FileSystemConfig_DefaultUid.Value;
            }
            if (requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultUid != null)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig.DefaultUid = requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_DefaultUid.Value;
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfigIsNull      = false;
            }
            System.String requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_MountPath = null;
            if (cmdletContext.FileSystemConfig_MountPath != null)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_MountPath = cmdletContext.FileSystemConfig_MountPath;
            }
            if (requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_MountPath != null)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig.MountPath = requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig_fileSystemConfig_MountPath;
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfigIsNull     = false;
            }
            // determine if requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig should be set to null
            if (requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfigIsNull)
            {
                requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig = null;
            }
            if (requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig != null)
            {
                request.KernelGatewayImageConfig.FileSystemConfig = requestKernelGatewayImageConfig_kernelGatewayImageConfig_FileSystemConfig;
                requestKernelGatewayImageConfigIsNull             = false;
            }
            // determine if request.KernelGatewayImageConfig should be set to null
            if (requestKernelGatewayImageConfigIsNull)
            {
                request.KernelGatewayImageConfig = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

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