private Amazon.ElasticBeanstalk.Model.CreatePlatformVersionResponse CallAWSServiceOperation(IAmazonElasticBeanstalk client, Amazon.ElasticBeanstalk.Model.CreatePlatformVersionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elastic Beanstalk", "CreatePlatformVersion"); try { #if DESKTOP return(client.CreatePlatformVersion(request)); #elif CORECLR return(client.CreatePlatformVersionAsync(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.ElasticBeanstalk.Model.CreatePlatformVersionRequest(); if (cmdletContext.EnvironmentName != null) { request.EnvironmentName = cmdletContext.EnvironmentName; } if (cmdletContext.OptionSetting != null) { request.OptionSettings = cmdletContext.OptionSetting; } // populate PlatformDefinitionBundle var requestPlatformDefinitionBundleIsNull = true; request.PlatformDefinitionBundle = new Amazon.ElasticBeanstalk.Model.S3Location(); System.String requestPlatformDefinitionBundle_platformDefinitionBundle_S3Bucket = null; if (cmdletContext.PlatformDefinitionBundle_S3Bucket != null) { requestPlatformDefinitionBundle_platformDefinitionBundle_S3Bucket = cmdletContext.PlatformDefinitionBundle_S3Bucket; } if (requestPlatformDefinitionBundle_platformDefinitionBundle_S3Bucket != null) { request.PlatformDefinitionBundle.S3Bucket = requestPlatformDefinitionBundle_platformDefinitionBundle_S3Bucket; requestPlatformDefinitionBundleIsNull = false; } System.String requestPlatformDefinitionBundle_platformDefinitionBundle_S3Key = null; if (cmdletContext.PlatformDefinitionBundle_S3Key != null) { requestPlatformDefinitionBundle_platformDefinitionBundle_S3Key = cmdletContext.PlatformDefinitionBundle_S3Key; } if (requestPlatformDefinitionBundle_platformDefinitionBundle_S3Key != null) { request.PlatformDefinitionBundle.S3Key = requestPlatformDefinitionBundle_platformDefinitionBundle_S3Key; requestPlatformDefinitionBundleIsNull = false; } // determine if request.PlatformDefinitionBundle should be set to null if (requestPlatformDefinitionBundleIsNull) { request.PlatformDefinitionBundle = null; } if (cmdletContext.PlatformName != null) { request.PlatformName = cmdletContext.PlatformName; } if (cmdletContext.PlatformVersion != null) { request.PlatformVersion = cmdletContext.PlatformVersion; } 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); }