/// <summary> /// Changes the settings of an existing AWS Cloud9 development environment. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateEnvironment service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the UpdateEnvironment service method, as returned by Cloud9.</returns> /// <exception cref="Amazon.Cloud9.Model.BadRequestException"> /// The target request is invalid. /// </exception> /// <exception cref="Amazon.Cloud9.Model.ConflictException"> /// A conflict occurred. /// </exception> /// <exception cref="Amazon.Cloud9.Model.ForbiddenException"> /// An access permissions issue occurred. /// </exception> /// <exception cref="Amazon.Cloud9.Model.InternalServerErrorException"> /// An internal server error occurred. /// </exception> /// <exception cref="Amazon.Cloud9.Model.LimitExceededException"> /// A service limit was exceeded. /// </exception> /// <exception cref="Amazon.Cloud9.Model.NotFoundException"> /// The target resource cannot be found. /// </exception> /// <exception cref="Amazon.Cloud9.Model.TooManyRequestsException"> /// Too many service requests were made over the given time period. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cloud9-2017-09-23/UpdateEnvironment">REST API Reference for UpdateEnvironment Operation</seealso> public virtual Task <UpdateEnvironmentResponse> UpdateEnvironmentAsync(UpdateEnvironmentRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = UpdateEnvironmentRequestMarshaller.Instance; options.ResponseUnmarshaller = UpdateEnvironmentResponseUnmarshaller.Instance; return(InvokeAsync <UpdateEnvironmentResponse>(request, options, cancellationToken)); }
internal virtual UpdateEnvironmentResponse UpdateEnvironment(UpdateEnvironmentRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = UpdateEnvironmentRequestMarshaller.Instance; options.ResponseUnmarshaller = UpdateEnvironmentResponseUnmarshaller.Instance; return(Invoke <UpdateEnvironmentResponse>(request, options)); }
public Environment UpdateEnvironment(string environmentId, UpdateEnvironmentRequest body) { try { var result = DiscoveryRepository.UpdateEnvironment(environmentId, body); return(result); } catch (Exception ex) { Logger.Error("DiscoveryService.UpdateEnvironment failed", this, ex); } return(null); }
/// <summary>Snippet for UpdateEnvironment</summary> public void UpdateEnvironmentRequestObject() { // Snippet: UpdateEnvironment(UpdateEnvironmentRequest, CallSettings) // Create client EnvironmentsClient environmentsClient = EnvironmentsClient.Create(); // Initialize request argument(s) UpdateEnvironmentRequest request = new UpdateEnvironmentRequest { Environment = new gcdv::Environment(), UpdateMask = new FieldMask(), AllowLoadToDraftAndDiscardChanges = false, }; // Make the request gcdv::Environment response = environmentsClient.UpdateEnvironment(request); // End snippet }
/// <summary>Snippet for UpdateEnvironmentAsync</summary> public async Task UpdateEnvironmentRequestObjectAsync() { // Snippet: UpdateEnvironmentAsync(UpdateEnvironmentRequest, CallSettings) // Additional: UpdateEnvironmentAsync(UpdateEnvironmentRequest, CancellationToken) // Create client EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync(); // Initialize request argument(s) UpdateEnvironmentRequest request = new UpdateEnvironmentRequest { Environment = new gcdv::Environment(), UpdateMask = new FieldMask(), AllowLoadToDraftAndDiscardChanges = false, }; // Make the request gcdv::Environment response = await environmentsClient.UpdateEnvironmentAsync(request); // End snippet }
private async Task <string> UpdateEnvironment(string application, string environment, string versionLabel) { this.Logger?.WriteLine("Updating environment {0} to new application version", environment); var updateRequest = new UpdateEnvironmentRequest { ApplicationName = application, EnvironmentName = environment, VersionLabel = versionLabel }; AddAdditionalOptions(updateRequest.OptionSettings); try { var updateEnvironmentRespone = await this.EBClient.UpdateEnvironmentAsync(updateRequest); return(updateEnvironmentRespone.EnvironmentArn); } catch (Exception e) { throw new ElasticBeanstalkExceptions("Error updating environment: " + e.Message, ElasticBeanstalkExceptions.EBCode.FailedToUpdateEnvironment); } }
private async Task <string> UpdateEnvironment(EnvironmentDescription environmentDescription, string versionLabel) { this.Logger?.WriteLine("Updating environment {0} to new application version", environmentDescription.EnvironmentName); var updateRequest = new UpdateEnvironmentRequest { ApplicationName = environmentDescription.ApplicationName, EnvironmentName = environmentDescription.EnvironmentName, VersionLabel = versionLabel }; AddAdditionalOptions(updateRequest.OptionSettings, false, EBUtilities.IsSolutionStackWindows(environmentDescription.SolutionStackName)); try { var updateEnvironmentResponse = await this.EBClient.UpdateEnvironmentAsync(updateRequest); return(updateEnvironmentResponse.EnvironmentArn); } catch (Exception e) { throw new ElasticBeanstalkExceptions("Error updating environment: " + e.Message, ElasticBeanstalkExceptions.EBCode.FailedToUpdateEnvironment); } }
/// <summary>Snippet for UpdateEnvironmentAsync</summary> public async Task UpdateEnvironmentRequestObjectAsync() { // Snippet: UpdateEnvironmentAsync(UpdateEnvironmentRequest, CallSettings) // Additional: UpdateEnvironmentAsync(UpdateEnvironmentRequest, CancellationToken) // Create client EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync(); // Initialize request argument(s) UpdateEnvironmentRequest request = new UpdateEnvironmentRequest { Environment = new gcoasv::Environment(), Name = "", UpdateMask = new FieldMask(), }; // Make the request Operation <gcoasv::Environment, OperationMetadata> response = await environmentsClient.UpdateEnvironmentAsync(request); // Poll until the returned long-running operation is complete Operation <gcoasv::Environment, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result gcoasv::Environment result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <gcoasv::Environment, OperationMetadata> retrievedResponse = await environmentsClient.PollOnceUpdateEnvironmentAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result gcoasv::Environment retrievedResult = retrievedResponse.Result; } // End snippet }
public void DisableScheduleActions(bool command) { var requestSettings = new DescribeConfigurationSettingsRequest() { ApplicationName = $"Safe-Arrival-{ environment.ToString()}-{GlobalVariables.Color}", EnvironmentName = $"{ environment.ToString()}-{GlobalVariables.Color}-API", }; var response = client.DescribeConfigurationSettings(requestSettings); var suspendSettings = response.ConfigurationSettings[0].OptionSettings.FindAll( o => o.Namespace == "aws:autoscaling:scheduledaction" && o.OptionName == "Suspend"); foreach (var setting in suspendSettings) { setting.Value = command.ToString(); } var request = new UpdateEnvironmentRequest() { ApplicationName = $"Safe-Arrival-{ environment.ToString()}-{GlobalVariables.Color}", EnvironmentName = $"{ environment.ToString()}-{GlobalVariables.Color}-API", OptionSettings = suspendSettings }; var responseUpdate = client.UpdateEnvironment(request); }
public void ChangeScheduleActionInstnaceNum(string scheduleActionname, int desiredCapacity, int max, int min) { var requestSettings = new DescribeConfigurationSettingsRequest() { ApplicationName = $"Safe-Arrival-{ environment.ToString()}-{GlobalVariables.Color}", EnvironmentName = $"{ environment.ToString()}-{GlobalVariables.Color}-API", }; var response = client.DescribeConfigurationSettings(requestSettings); var settings = new List <ConfigurationOptionSetting>(); var sourceSettings = response.ConfigurationSettings[0].OptionSettings.FindAll( o => o.Namespace == "aws:autoscaling:scheduledaction"); //Now have to hard code the resource name because no way to store the setting original value before set them to 0; //HashSet<string> resourceNameList = new HashSet<string>(); //foreach (var optionSettings in sourceSettings) //{ // resourceNameList.Add(optionSettings.ResourceName); //} foreach (var optionSettings in sourceSettings) { if (optionSettings.OptionName == "DesiredCapacity") { settings.Add(new ConfigurationOptionSetting() { Namespace = optionSettings.Namespace, OptionName = optionSettings.OptionName, ResourceName = optionSettings.ResourceName, Value = desiredCapacity.ToString() }); } if (optionSettings.OptionName == "MaxSize") { settings.Add(new ConfigurationOptionSetting() { Namespace = optionSettings.Namespace, OptionName = optionSettings.OptionName, ResourceName = optionSettings.ResourceName, Value = max.ToString() }); } if (optionSettings.OptionName == "MinSize") { settings.Add(new ConfigurationOptionSetting() { Namespace = optionSettings.Namespace, OptionName = optionSettings.OptionName, ResourceName = optionSettings.ResourceName, Value = min.ToString() }); } } //UpdateConfigurationTemplateRequest request = new UpdateConfigurationTemplateRequest() //{ //}; //client.UpdateConfigurationTemplate(request); var request = new UpdateEnvironmentRequest() { ApplicationName = $"Safe-Arrival-{ environment.ToString()}-{GlobalVariables.Color}", EnvironmentName = $"{ environment.ToString()}-{GlobalVariables.Color}-API", OptionSettings = settings }; client.UpdateEnvironment(request); }