/// <summary> /// <para>Creates an application version for the specified application.</para> <para><b>NOTE:</b>Once you create an application version with a /// specified Amazon S3 bucket and key location, you cannot change that Amazon S3 location. If you change the Amazon S3 location, you receive an /// exception when you attempt to launch an environment from the application version. </para> /// </summary> /// /// <param name="createApplicationVersionRequest">Container for the necessary parameters to execute the CreateApplicationVersion service method /// on AmazonElasticBeanstalk.</param> /// /// <returns>The response from the CreateApplicationVersion service method, as returned by AmazonElasticBeanstalk.</returns> /// /// <exception cref="TooManyApplicationsException"/> /// <exception cref="TooManyApplicationVersionsException"/> public CreateApplicationVersionResponse CreateApplicationVersion(CreateApplicationVersionRequest createApplicationVersionRequest) { IAsyncResult asyncResult = invokeCreateApplicationVersion(createApplicationVersionRequest, null, null, true); return EndCreateApplicationVersion(asyncResult); }
IAsyncResult invokeCreateApplicationVersion(CreateApplicationVersionRequest createApplicationVersionRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateApplicationVersionRequestMarshaller().Marshall(createApplicationVersionRequest); var unmarshaller = CreateApplicationVersionResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the CreateApplicationVersion operation. /// <seealso cref="Amazon.ElasticBeanstalk.AmazonElasticBeanstalk.CreateApplicationVersion"/> /// </summary> /// /// <param name="createApplicationVersionRequest">Container for the necessary parameters to execute the CreateApplicationVersion operation on /// AmazonElasticBeanstalk.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking /// EndCreateApplicationVersion operation.</returns> public IAsyncResult BeginCreateApplicationVersion(CreateApplicationVersionRequest createApplicationVersionRequest, AsyncCallback callback, object state) { return invokeCreateApplicationVersion(createApplicationVersionRequest, callback, state, false); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ElasticBeanstalk.Model.CreateApplicationVersionRequest(); if (cmdletContext.ApplicationName != null) { request.ApplicationName = cmdletContext.ApplicationName; } if (cmdletContext.AutoCreateApplication != null) { request.AutoCreateApplication = cmdletContext.AutoCreateApplication.Value; } // populate BuildConfiguration var requestBuildConfigurationIsNull = true; request.BuildConfiguration = new Amazon.ElasticBeanstalk.Model.BuildConfiguration(); System.String requestBuildConfiguration_buildConfiguration_ArtifactName = null; if (cmdletContext.BuildConfiguration_ArtifactName != null) { requestBuildConfiguration_buildConfiguration_ArtifactName = cmdletContext.BuildConfiguration_ArtifactName; } if (requestBuildConfiguration_buildConfiguration_ArtifactName != null) { request.BuildConfiguration.ArtifactName = requestBuildConfiguration_buildConfiguration_ArtifactName; requestBuildConfigurationIsNull = false; } System.String requestBuildConfiguration_buildConfiguration_CodeBuildServiceRole = null; if (cmdletContext.BuildConfiguration_CodeBuildServiceRole != null) { requestBuildConfiguration_buildConfiguration_CodeBuildServiceRole = cmdletContext.BuildConfiguration_CodeBuildServiceRole; } if (requestBuildConfiguration_buildConfiguration_CodeBuildServiceRole != null) { request.BuildConfiguration.CodeBuildServiceRole = requestBuildConfiguration_buildConfiguration_CodeBuildServiceRole; requestBuildConfigurationIsNull = false; } Amazon.ElasticBeanstalk.ComputeType requestBuildConfiguration_buildConfiguration_ComputeType = null; if (cmdletContext.BuildConfiguration_ComputeType != null) { requestBuildConfiguration_buildConfiguration_ComputeType = cmdletContext.BuildConfiguration_ComputeType; } if (requestBuildConfiguration_buildConfiguration_ComputeType != null) { request.BuildConfiguration.ComputeType = requestBuildConfiguration_buildConfiguration_ComputeType; requestBuildConfigurationIsNull = false; } System.String requestBuildConfiguration_buildConfiguration_Image = null; if (cmdletContext.BuildConfiguration_Image != null) { requestBuildConfiguration_buildConfiguration_Image = cmdletContext.BuildConfiguration_Image; } if (requestBuildConfiguration_buildConfiguration_Image != null) { request.BuildConfiguration.Image = requestBuildConfiguration_buildConfiguration_Image; requestBuildConfigurationIsNull = false; } System.Int32?requestBuildConfiguration_buildConfiguration_TimeoutInMinute = null; if (cmdletContext.BuildConfiguration_TimeoutInMinute != null) { requestBuildConfiguration_buildConfiguration_TimeoutInMinute = cmdletContext.BuildConfiguration_TimeoutInMinute.Value; } if (requestBuildConfiguration_buildConfiguration_TimeoutInMinute != null) { request.BuildConfiguration.TimeoutInMinutes = requestBuildConfiguration_buildConfiguration_TimeoutInMinute.Value; requestBuildConfigurationIsNull = false; } // determine if request.BuildConfiguration should be set to null if (requestBuildConfigurationIsNull) { request.BuildConfiguration = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Process != null) { request.Process = cmdletContext.Process.Value; } // populate SourceBuildInformation var requestSourceBuildInformationIsNull = true; request.SourceBuildInformation = new Amazon.ElasticBeanstalk.Model.SourceBuildInformation(); System.String requestSourceBuildInformation_sourceBuildInformation_SourceLocation = null; if (cmdletContext.SourceBuildInformation_SourceLocation != null) { requestSourceBuildInformation_sourceBuildInformation_SourceLocation = cmdletContext.SourceBuildInformation_SourceLocation; } if (requestSourceBuildInformation_sourceBuildInformation_SourceLocation != null) { request.SourceBuildInformation.SourceLocation = requestSourceBuildInformation_sourceBuildInformation_SourceLocation; requestSourceBuildInformationIsNull = false; } Amazon.ElasticBeanstalk.SourceRepository requestSourceBuildInformation_sourceBuildInformation_SourceRepository = null; if (cmdletContext.SourceBuildInformation_SourceRepository != null) { requestSourceBuildInformation_sourceBuildInformation_SourceRepository = cmdletContext.SourceBuildInformation_SourceRepository; } if (requestSourceBuildInformation_sourceBuildInformation_SourceRepository != null) { request.SourceBuildInformation.SourceRepository = requestSourceBuildInformation_sourceBuildInformation_SourceRepository; requestSourceBuildInformationIsNull = false; } Amazon.ElasticBeanstalk.SourceType requestSourceBuildInformation_sourceBuildInformation_SourceType = null; if (cmdletContext.SourceBuildInformation_SourceType != null) { requestSourceBuildInformation_sourceBuildInformation_SourceType = cmdletContext.SourceBuildInformation_SourceType; } if (requestSourceBuildInformation_sourceBuildInformation_SourceType != null) { request.SourceBuildInformation.SourceType = requestSourceBuildInformation_sourceBuildInformation_SourceType; requestSourceBuildInformationIsNull = false; } // determine if request.SourceBuildInformation should be set to null if (requestSourceBuildInformationIsNull) { request.SourceBuildInformation = null; } // populate SourceBundle var requestSourceBundleIsNull = true; request.SourceBundle = new Amazon.ElasticBeanstalk.Model.S3Location(); System.String requestSourceBundle_sourceBundle_S3Bucket = null; if (cmdletContext.SourceBundle_S3Bucket != null) { requestSourceBundle_sourceBundle_S3Bucket = cmdletContext.SourceBundle_S3Bucket; } if (requestSourceBundle_sourceBundle_S3Bucket != null) { request.SourceBundle.S3Bucket = requestSourceBundle_sourceBundle_S3Bucket; requestSourceBundleIsNull = false; } System.String requestSourceBundle_sourceBundle_S3Key = null; if (cmdletContext.SourceBundle_S3Key != null) { requestSourceBundle_sourceBundle_S3Key = cmdletContext.SourceBundle_S3Key; } if (requestSourceBundle_sourceBundle_S3Key != null) { request.SourceBundle.S3Key = requestSourceBundle_sourceBundle_S3Key; requestSourceBundleIsNull = false; } // determine if request.SourceBundle should be set to null if (requestSourceBundleIsNull) { request.SourceBundle = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.VersionLabel != null) { request.VersionLabel = cmdletContext.VersionLabel; } 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); }
private Amazon.ElasticBeanstalk.Model.CreateApplicationVersionResponse CallAWSServiceOperation(IAmazonElasticBeanstalk client, Amazon.ElasticBeanstalk.Model.CreateApplicationVersionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elastic Beanstalk", "CreateApplicationVersion"); try { #if DESKTOP return(client.CreateApplicationVersion(request)); #elif CORECLR return(client.CreateApplicationVersionAsync(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; } }
internal CreateApplicationVersionResponse CreateApplicationVersion(CreateApplicationVersionRequest request) { var marshaller = new CreateApplicationVersionRequestMarshaller(); var unmarshaller = CreateApplicationVersionResponseUnmarshaller.Instance; return Invoke<CreateApplicationVersionRequest,CreateApplicationVersionResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateApplicationVersion operation. /// <seealso cref="Amazon.ElasticBeanstalk.IAmazonElasticBeanstalk"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateApplicationVersion operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<CreateApplicationVersionResponse> CreateApplicationVersionAsync(CreateApplicationVersionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateApplicationVersionRequestMarshaller(); var unmarshaller = CreateApplicationVersionResponseUnmarshaller.Instance; return InvokeAsync<CreateApplicationVersionRequest,CreateApplicationVersionResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// <para>Creates an application version for the specified application.</para> <para><b>NOTE:</b>Once you create an application version with a /// specified Amazon S3 bucket and key location, you cannot change that Amazon S3 location. If you change the Amazon S3 location, you receive an /// exception when you attempt to launch an environment from the application version. </para> /// </summary> /// /// <param name="createApplicationVersionRequest">Container for the necessary parameters to execute the CreateApplicationVersion service method /// on AmazonElasticBeanstalk.</param> /// /// <returns>The response from the CreateApplicationVersion service method, as returned by AmazonElasticBeanstalk.</returns> /// /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyApplicationsException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.InsufficientPrivilegesException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyApplicationVersionsException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.S3LocationNotInServiceRegionException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<CreateApplicationVersionResponse> CreateApplicationVersionAsync(CreateApplicationVersionRequest createApplicationVersionRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateApplicationVersionRequestMarshaller(); var unmarshaller = CreateApplicationVersionResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateApplicationVersionRequest, CreateApplicationVersionResponse>(createApplicationVersionRequest, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para>Creates an application version for the specified application.</para> <para><b>NOTE:</b>Once you create an application version with a /// specified Amazon S3 bucket and key location, you cannot change that Amazon S3 location. If you change the Amazon S3 location, you receive an /// exception when you attempt to launch an environment from the application version. </para> /// </summary> /// /// <param name="createApplicationVersionRequest">Container for the necessary parameters to execute the CreateApplicationVersion service method /// on AmazonElasticBeanstalk.</param> /// /// <returns>The response from the CreateApplicationVersion service method, as returned by AmazonElasticBeanstalk.</returns> /// /// <exception cref="TooManyApplicationsException"/> /// <exception cref="TooManyApplicationVersionsException"/> public CreateApplicationVersionResponse CreateApplicationVersion(CreateApplicationVersionRequest createApplicationVersionRequest) { IRequest<CreateApplicationVersionRequest> request = new CreateApplicationVersionRequestMarshaller().Marshall(createApplicationVersionRequest); CreateApplicationVersionResponse response = Invoke<CreateApplicationVersionRequest, CreateApplicationVersionResponse> (request, this.signer, CreateApplicationVersionResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// /// </summary> /// <param name="createApplicationVersionRequest"></param> /// <returns></returns> public async Task CreateOrUpdateApplicationAsync(CreateApplicationVersionRequest createApplicationVersionRequest) { using (var ebClient = new AmazonElasticBeanstalkClient(creds, configurationProvider.RegionEndpoint)) { if (await IsNewApplicationAsync(ebClient)) { loggerProvider.GetLogger().Debug("New application - creating..."); var createApplicationRequest = new CreateApplicationRequest { ApplicationName = configurationProvider.LongApplicationName }; var createApplicationResponse = await ebClient.CreateApplicationAsync(createApplicationRequest); loggerProvider.GetLogger().Debug($"Created application: {createApplicationResponse}"); } var describeApplicationsRequest = new DescribeApplicationVersionsRequest { ApplicationName = configurationProvider.LongApplicationName, VersionLabels = new List<string> { configurationProvider.Version } }; var apps = await ebClient.DescribeApplicationVersionsAsync(describeApplicationsRequest); if (apps.ApplicationVersions.Any()) { loggerProvider.GetLogger().Debug("Application Version already exists"); return; } loggerProvider.GetLogger().Debug("Creating application version..."); var createApplicationVersionResponse = await ebClient.CreateApplicationVersionAsync(createApplicationVersionRequest); loggerProvider.GetLogger().Debug($"Created application version: {createApplicationVersionResponse}"); } }
internal CreateApplicationVersionResponse CreateApplicationVersion(CreateApplicationVersionRequest request) { var task = CreateApplicationVersionAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the CreateApplicationVersion operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateApplicationVersion operation on AmazonElasticBeanstalkClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateApplicationVersion /// operation.</returns> public IAsyncResult BeginCreateApplicationVersion(CreateApplicationVersionRequest request, AsyncCallback callback, object state) { var marshaller = new CreateApplicationVersionRequestMarshaller(); var unmarshaller = CreateApplicationVersionResponseUnmarshaller.Instance; return BeginInvoke<CreateApplicationVersionRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeCreateApplicationVersion(CreateApplicationVersionRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new CreateApplicationVersionRequestMarshaller(); var unmarshaller = CreateApplicationVersionResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// <para>Creates an application version for the specified application.</para> <para><b>NOTE:</b>Once you create an application version with a /// specified Amazon S3 bucket and key location, you cannot change that Amazon S3 location. If you change the Amazon S3 location, you receive an /// exception when you attempt to launch an environment from the application version. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateApplicationVersion service method /// on AmazonElasticBeanstalk.</param> /// /// <returns>The response from the CreateApplicationVersion service method, as returned by AmazonElasticBeanstalk.</returns> /// /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyApplicationsException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.InsufficientPrivilegesException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyApplicationVersionsException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.S3LocationNotInServiceRegionException" /> public CreateApplicationVersionResponse CreateApplicationVersion(CreateApplicationVersionRequest request) { var task = CreateApplicationVersionAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Constructs the Configuration Option Settings related to the VPC (Virtual Private Cloud) /// </summary> /// <returns>List of ConfigurationOptionSettings</returns> // private async Task<List<ConfigurationOptionSetting>> GetVpcMultAzConfigurationOptionSettingsAsync() // { // var configurationOptionSettings = new List<ConfigurationOptionSetting>(); // var vpcId = await ec2Service.GetVpcIdAsync(); // LoggerProvider.GetLogger().Debug("Found VPCId {vpcId}", vpcId); // configurationOptionSettings.Add(new ConfigurationOptionSetting // { // Namespace = "aws:ec2:vpc", // OptionName = "VPCId", // Value = vpcId // }); // var availabilityZones = new List<string> { "us-east-1b", "us-east-1c" }; // var privateSubnetIds = await ec2Service.GetPrivateSubnetIdsAsync(vpcId, availabilityZones); // var privateSubnetIdsString = privateSubnetIds.Join(","); // LoggerProvider.GetLogger().Debug("Found private subnet ID {privateSubnetId}", privateSubnetIds); // configurationOptionSettings.Add(new ConfigurationOptionSetting // { // Namespace = "aws:ec2:vpc", // OptionName = "Subnets", // Value = privateSubnetIdsString // }); // var publicSubnetIds = await ec2Service.GetPublicSubnetIdsAsync(vpcId, availabilityZones); // var publicSubnetIdsString = publicSubnetIds.Join(","); // LoggerProvider.GetLogger().Debug("Found public subnet ID {publicSubnetId}", publicSubnetIds); // configurationOptionSettings.Add(new ConfigurationOptionSetting // { // Namespace = "aws:ec2:vpc", // OptionName = "ELBSubnets", // Value = publicSubnetIdsString // }); // // return configurationOptionSettings; // } // private async Task<List<ConfigurationOptionSetting>> GetVpcConfigurationOptionSettingsAsync() // { // var configurationOptionSettings = new List<ConfigurationOptionSetting>(); // var vpcId = await ec2Service.GetVpcIdAsync(); // LoggerProvider.GetLogger().Debug("Found VPCId {vpcId}", vpcId); // configurationOptionSettings.Add(new ConfigurationOptionSetting // { // Namespace = "aws:ec2:vpc", // OptionName = "VPCId", // Value = vpcId // }); // var availabilityZone = "us-east-1b"; // TODO: deploy across AZs // var privateSubnetId = await ec2Service.GetPrivateSubnetIdAsync(vpcId, availabilityZone); // LoggerProvider.GetLogger().Debug("Found private subnet ID {privateSubnetId}", privateSubnetId); // configurationOptionSettings.Add(new ConfigurationOptionSetting // { // Namespace = "aws:ec2:vpc", // OptionName = "Subnets", // Value = privateSubnetId // }); // var publicSubnetId = await ec2Service.GetPublicSubnetIdAsync(vpcId, availabilityZone); // LoggerProvider.GetLogger().Debug("Found public subnet ID {publicSubnetId}", publicSubnetId); // configurationOptionSettings.Add(new ConfigurationOptionSetting // { // Namespace = "aws:ec2:vpc", // OptionName = "ELBSubnets", // Value = publicSubnetId // }); // // return configurationOptionSettings; // } private async Task CreateOrUpdateApplicationAsync() { var createApplicationVersionRequest = new CreateApplicationVersionRequest { ApplicationName = configProvider.LongApplicationName, VersionLabel = configProvider.Version, SourceBundle = s3Service.GetS3Location() }; await elasticBeanstalkService.CreateOrUpdateApplicationAsync(createApplicationVersionRequest); }
/// <summary> /// <para>Creates an application version for the specified application.</para> <para><b>NOTE:</b>Once you create an application version with a /// specified Amazon S3 bucket and key location, you cannot change that Amazon S3 location. If you change the Amazon S3 location, you receive an /// exception when you attempt to launch an environment from the application version. </para> /// </summary> /// /// <param name="createApplicationVersionRequest">Container for the necessary parameters to execute the CreateApplicationVersion service method /// on AmazonElasticBeanstalk.</param> /// /// <returns>The response from the CreateApplicationVersion service method, as returned by AmazonElasticBeanstalk.</returns> /// /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyApplicationsException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.InsufficientPrivilegesException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyApplicationVersionsException" /> /// <exception cref="T:Amazon.ElasticBeanstalk.Model.S3LocationNotInServiceRegionException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<CreateApplicationVersionResponse> CreateApplicationVersionAsync(CreateApplicationVersionRequest createApplicationVersionRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateApplicationVersionRequestMarshaller(); var unmarshaller = CreateApplicationVersionResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateApplicationVersionRequest, CreateApplicationVersionResponse>(createApplicationVersionRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }