private Amazon.AppConfig.Model.CreateHostedConfigurationVersionResponse CallAWSServiceOperation(IAmazonAppConfig client, Amazon.AppConfig.Model.CreateHostedConfigurationVersionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS AppConfig", "CreateHostedConfigurationVersion");
     try
     {
         #if DESKTOP
         return(client.CreateHostedConfigurationVersion(request));
         #elif CORECLR
         return(client.CreateHostedConfigurationVersionAsync(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)
        {
            System.IO.MemoryStream _ContentStream = null;

            try
            {
                var cmdletContext = context as CmdletContext;
                // create request
                var request = new Amazon.AppConfig.Model.CreateHostedConfigurationVersionRequest();

                if (cmdletContext.ApplicationId != null)
                {
                    request.ApplicationId = cmdletContext.ApplicationId;
                }
                if (cmdletContext.ConfigurationProfileId != null)
                {
                    request.ConfigurationProfileId = cmdletContext.ConfigurationProfileId;
                }
                if (cmdletContext.Content != null)
                {
                    _ContentStream  = new System.IO.MemoryStream(cmdletContext.Content);
                    request.Content = _ContentStream;
                }
                if (cmdletContext.ContentType != null)
                {
                    request.ContentType = cmdletContext.ContentType;
                }
                if (cmdletContext.Description != null)
                {
                    request.Description = cmdletContext.Description;
                }
                if (cmdletContext.LatestVersionNumber != null)
                {
                    request.LatestVersionNumber = cmdletContext.LatestVersionNumber.Value;
                }

                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);
            }
            finally
            {
                if (_ContentStream != null)
                {
                    _ContentStream.Dispose();
                }
            }
        }