Container for the parameters to the CreateEnvironment operation.

Launches an environment for the specified application using the specified configuration.

Inheritance: AmazonElasticBeanstalkRequest
 /// <summary>
 /// Initiates the asynchronous execution of the CreateEnvironment operation.
 /// <seealso cref="Amazon.ElasticBeanstalk.AmazonElasticBeanstalk.CreateEnvironment"/>
 /// </summary>
 /// 
 /// <param name="createEnvironmentRequest">Container for the necessary parameters to execute the CreateEnvironment 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 EndCreateEnvironment
 ///         operation.</returns>
 public IAsyncResult BeginCreateEnvironment(CreateEnvironmentRequest createEnvironmentRequest, AsyncCallback callback, object state)
 {
     return invokeCreateEnvironment(createEnvironmentRequest, callback, state, false);
 }
 /// <summary>
 /// <para> Launches an environment for the specified application using the specified configuration. </para>
 /// </summary>
 /// 
 /// <param name="createEnvironmentRequest">Container for the necessary parameters to execute the CreateEnvironment service method on
 ///          AmazonElasticBeanstalk.</param>
 /// 
 /// <returns>The response from the CreateEnvironment service method, as returned by AmazonElasticBeanstalk.</returns>
 /// 
 /// <exception cref="TooManyEnvironmentsException"/>
 public CreateEnvironmentResponse CreateEnvironment(CreateEnvironmentRequest createEnvironmentRequest)
 {
     IAsyncResult asyncResult = invokeCreateEnvironment(createEnvironmentRequest, null, null, true);
     return EndCreateEnvironment(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateEnvironment operation.
        /// <seealso cref="Amazon.ElasticBeanstalk.IAmazonElasticBeanstalk"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateEnvironment 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<CreateEnvironmentResponse> CreateEnvironmentAsync(CreateEnvironmentRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateEnvironmentRequestMarshaller();
            var unmarshaller = CreateEnvironmentResponseUnmarshaller.Instance;

            return InvokeAsync<CreateEnvironmentRequest,CreateEnvironmentResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 IAsyncResult invokeCreateEnvironment(CreateEnvironmentRequest createEnvironmentRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new CreateEnvironmentRequestMarshaller().Marshall(createEnvironmentRequest);
     var unmarshaller = CreateEnvironmentResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
  /// <summary>
  /// <para> Launches an environment for the specified application using the specified configuration. </para>
  /// </summary>
  /// 
  /// <param name="createEnvironmentRequest">Container for the necessary parameters to execute the CreateEnvironment service method on
  ///           AmazonElasticBeanstalk.</param>
  /// 
  /// <returns>The response from the CreateEnvironment service method, as returned by AmazonElasticBeanstalk.</returns>
  /// 
  /// <exception cref="TooManyEnvironmentsException"/>
 public CreateEnvironmentResponse CreateEnvironment(CreateEnvironmentRequest createEnvironmentRequest) 
 {           
     IRequest<CreateEnvironmentRequest> request = new CreateEnvironmentRequestMarshaller().Marshall(createEnvironmentRequest);
     CreateEnvironmentResponse response = Invoke<CreateEnvironmentRequest, CreateEnvironmentResponse> (request, this.signer, CreateEnvironmentResponseUnmarshaller.GetInstance());
     return response;
 }
        internal CreateEnvironmentResponse CreateEnvironment(CreateEnvironmentRequest request)
        {
            var marshaller = new CreateEnvironmentRequestMarshaller();
            var unmarshaller = CreateEnvironmentResponseUnmarshaller.Instance;

            return Invoke<CreateEnvironmentRequest,CreateEnvironmentResponse>(request, marshaller, unmarshaller);
        }
Esempio n. 7
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ElasticBeanstalk.Model.CreateEnvironmentRequest();

            if (cmdletContext.ApplicationName != null)
            {
                request.ApplicationName = cmdletContext.ApplicationName;
            }
            if (cmdletContext.CNAMEPrefix != null)
            {
                request.CNAMEPrefix = cmdletContext.CNAMEPrefix;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.EnvironmentName != null)
            {
                request.EnvironmentName = cmdletContext.EnvironmentName;
            }
            if (cmdletContext.GroupName != null)
            {
                request.GroupName = cmdletContext.GroupName;
            }
            if (cmdletContext.OperationsRole != null)
            {
                request.OperationsRole = cmdletContext.OperationsRole;
            }
            if (cmdletContext.OptionSetting != null)
            {
                request.OptionSettings = cmdletContext.OptionSetting;
            }
            if (cmdletContext.OptionsToRemove != null)
            {
                request.OptionsToRemove = cmdletContext.OptionsToRemove;
            }
            if (cmdletContext.PlatformArn != null)
            {
                request.PlatformArn = cmdletContext.PlatformArn;
            }
            if (cmdletContext.SolutionStackName != null)
            {
                request.SolutionStackName = cmdletContext.SolutionStackName;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.TemplateName != null)
            {
                request.TemplateName = cmdletContext.TemplateName;
            }

            // populate Tier
            var requestTierIsNull = true;

            request.Tier = new Amazon.ElasticBeanstalk.Model.EnvironmentTier();
            System.String requestTier_tier_Name = null;
            if (cmdletContext.Tier_Name != null)
            {
                requestTier_tier_Name = cmdletContext.Tier_Name;
            }
            if (requestTier_tier_Name != null)
            {
                request.Tier.Name = requestTier_tier_Name;
                requestTierIsNull = false;
            }
            System.String requestTier_tier_Type = null;
            if (cmdletContext.Tier_Type != null)
            {
                requestTier_tier_Type = cmdletContext.Tier_Type;
            }
            if (requestTier_tier_Type != null)
            {
                request.Tier.Type = requestTier_tier_Type;
                requestTierIsNull = false;
            }
            System.String requestTier_tier_Version = null;
            if (cmdletContext.Tier_Version != null)
            {
                requestTier_tier_Version = cmdletContext.Tier_Version;
            }
            if (requestTier_tier_Version != null)
            {
                request.Tier.Version = requestTier_tier_Version;
                requestTierIsNull    = false;
            }
            // determine if request.Tier should be set to null
            if (requestTierIsNull)
            {
                request.Tier = null;
            }
            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);
        }
Esempio n. 8
0
 private Amazon.ElasticBeanstalk.Model.CreateEnvironmentResponse CallAWSServiceOperation(IAmazonElasticBeanstalk client, Amazon.ElasticBeanstalk.Model.CreateEnvironmentRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elastic Beanstalk", "CreateEnvironment");
     try
     {
         #if DESKTOP
         return(client.CreateEnvironment(request));
         #elif CORECLR
         return(client.CreateEnvironmentAsync(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 CreateEnvironmentResponse CreateEnvironment(CreateEnvironmentRequest request)
        {
            var task = CreateEnvironmentAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// <para> Launches an environment for the specified application using the specified configuration. </para>
        /// </summary>
        /// 
        /// <param name="createEnvironmentRequest">Container for the necessary parameters to execute the CreateEnvironment service method on
        /// AmazonElasticBeanstalk.</param>
        /// 
        /// <returns>The response from the CreateEnvironment service method, as returned by AmazonElasticBeanstalk.</returns>
        /// 
        /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyEnvironmentsException" />
        /// <exception cref="T:Amazon.ElasticBeanstalk.Model.InsufficientPrivilegesException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<CreateEnvironmentResponse> CreateEnvironmentAsync(CreateEnvironmentRequest createEnvironmentRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateEnvironmentRequestMarshaller();
            var unmarshaller = CreateEnvironmentResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, CreateEnvironmentRequest, CreateEnvironmentResponse>(createEnvironmentRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
        private async Task CreateIisNextEnvironmentAsync(string environmentIdentifier, string version, List<ConfigurationOptionSetting> optionSettings)
        {
            loggerProvider.GetLogger()
                .Debug("New environment - creating \"Next\" {identifier} {version}...", environmentIdentifier, version);
            using (var ebClient = new AmazonElasticBeanstalkClient(creds, configurationProvider.RegionEndpoint))
            {
                var optionSettingsApp = GetAppSpecificCreateConfigurationOptionSettings();
                loggerProvider.GetLogger().Debug("Parsed configuration option settings: {@optionSettings}", optionSettingsApp);
                optionSettings = InjectAppSpecificOptionSettings(optionSettings, optionSettingsApp);
                loggerProvider.GetLogger()
                    .Debug("Create next environment: total option settings count - {optionSettingsCount}",
                        optionSettings.Count);

                var currentEnvironmentName = $"{configurationProvider.BeanstalkEnvironmentName}-{environmentIdentifier}";
                var createEnvironmentRequest =
                    new CreateEnvironmentRequest(configurationProvider.LongApplicationName,
                        currentEnvironmentName)
                    {
                        Tier = new EnvironmentTier { Name = "WebServer", Type = "Standard" },
                        SolutionStackName = "64bit Windows Server Core 2012 R2 running IIS 8.5",
                        CNAMEPrefix = nextCNamePrefix,
                        VersionLabel = version,
                        OptionSettings = optionSettings
                    };
                var createEnvironmentResponse = await ebClient.CreateEnvironmentAsync(createEnvironmentRequest);
                await EnsureCreateEnvironmentCompleteAsync(createEnvironmentResponse.EnvironmentId);
                loggerProvider.GetLogger()
                    .Debug("Created \"Next\" environment: {@createEnvironmentResponse}", createEnvironmentResponse);
                // TODO: capture createEnvironmentResponse.Cname as TestUri - SRO
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateEnvironment operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateEnvironment 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 EndCreateEnvironment
        ///         operation.</returns>
        public IAsyncResult BeginCreateEnvironment(CreateEnvironmentRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateEnvironmentRequestMarshaller();
            var unmarshaller = CreateEnvironmentResponseUnmarshaller.Instance;

            return BeginInvoke<CreateEnvironmentRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        IAsyncResult invokeCreateEnvironment(CreateEnvironmentRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new CreateEnvironmentRequestMarshaller();
            var unmarshaller = CreateEnvironmentResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
        /// <summary>
        /// <para> Launches an environment for the specified application using the specified configuration. </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateEnvironment service method on
        /// AmazonElasticBeanstalk.</param>
        /// 
        /// <returns>The response from the CreateEnvironment service method, as returned by AmazonElasticBeanstalk.</returns>
        /// 
        /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyEnvironmentsException" />
        /// <exception cref="T:Amazon.ElasticBeanstalk.Model.InsufficientPrivilegesException" />
		public CreateEnvironmentResponse CreateEnvironment(CreateEnvironmentRequest request)
        {
            var task = CreateEnvironmentAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// <para> Launches an environment for the specified application using the specified configuration. </para>
        /// </summary>
        /// 
        /// <param name="createEnvironmentRequest">Container for the necessary parameters to execute the CreateEnvironment service method on
        /// AmazonElasticBeanstalk.</param>
        /// 
        /// <returns>The response from the CreateEnvironment service method, as returned by AmazonElasticBeanstalk.</returns>
        /// 
        /// <exception cref="T:Amazon.ElasticBeanstalk.Model.TooManyEnvironmentsException" />
        /// <exception cref="T:Amazon.ElasticBeanstalk.Model.InsufficientPrivilegesException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<CreateEnvironmentResponse> CreateEnvironmentAsync(CreateEnvironmentRequest createEnvironmentRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateEnvironmentRequestMarshaller();
            var unmarshaller = CreateEnvironmentResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, CreateEnvironmentRequest, CreateEnvironmentResponse>(createEnvironmentRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }