private Amazon.Imagebuilder.Model.CreateContainerRecipeResponse CallAWSServiceOperation(IAmazonImagebuilder client, Amazon.Imagebuilder.Model.CreateContainerRecipeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "EC2 Image Builder", "CreateContainerRecipe");
     try
     {
         #if DESKTOP
         return(client.CreateContainerRecipe(request));
         #elif CORECLR
         return(client.CreateContainerRecipeAsync(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.Imagebuilder.Model.CreateContainerRecipeRequest();

            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.Component != null)
            {
                request.Components = cmdletContext.Component;
            }
            if (cmdletContext.ContainerType != null)
            {
                request.ContainerType = cmdletContext.ContainerType;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.DockerfileTemplateData != null)
            {
                request.DockerfileTemplateData = cmdletContext.DockerfileTemplateData;
            }
            if (cmdletContext.DockerfileTemplateUri != null)
            {
                request.DockerfileTemplateUri = cmdletContext.DockerfileTemplateUri;
            }
            if (cmdletContext.ImageOsVersionOverride != null)
            {
                request.ImageOsVersionOverride = cmdletContext.ImageOsVersionOverride;
            }
            if (cmdletContext.KmsKeyId != null)
            {
                request.KmsKeyId = cmdletContext.KmsKeyId;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.ParentImage != null)
            {
                request.ParentImage = cmdletContext.ParentImage;
            }
            if (cmdletContext.PlatformOverride != null)
            {
                request.PlatformOverride = cmdletContext.PlatformOverride;
            }
            if (cmdletContext.SemanticVersion != null)
            {
                request.SemanticVersion = cmdletContext.SemanticVersion;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            // populate TargetRepository
            var requestTargetRepositoryIsNull = true;

            request.TargetRepository = new Amazon.Imagebuilder.Model.TargetContainerRepository();
            System.String requestTargetRepository_targetRepository_RepositoryName = null;
            if (cmdletContext.TargetRepository_RepositoryName != null)
            {
                requestTargetRepository_targetRepository_RepositoryName = cmdletContext.TargetRepository_RepositoryName;
            }
            if (requestTargetRepository_targetRepository_RepositoryName != null)
            {
                request.TargetRepository.RepositoryName = requestTargetRepository_targetRepository_RepositoryName;
                requestTargetRepositoryIsNull           = false;
            }
            Amazon.Imagebuilder.ContainerRepositoryService requestTargetRepository_targetRepository_Service = null;
            if (cmdletContext.TargetRepository_Service != null)
            {
                requestTargetRepository_targetRepository_Service = cmdletContext.TargetRepository_Service;
            }
            if (requestTargetRepository_targetRepository_Service != null)
            {
                request.TargetRepository.Service = requestTargetRepository_targetRepository_Service;
                requestTargetRepositoryIsNull    = false;
            }
            // determine if request.TargetRepository should be set to null
            if (requestTargetRepositoryIsNull)
            {
                request.TargetRepository = null;
            }
            if (cmdletContext.WorkingDirectory != null)
            {
                request.WorkingDirectory = cmdletContext.WorkingDirectory;
            }

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