use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElasticBeanstalkSetupTest method testDescribeConfigurationTemplateExistingTemplate.
@Test
public void testDescribeConfigurationTemplateExistingTemplate() {
DescribeConfigurationOptionsRequest dcoReq = new DescribeConfigurationOptionsRequest().withApplicationName(config.getElasticBeanstalkApplicationName()).withTemplateName("tempExist");
DescribeConfigurationOptionsResult expectedDcoRes = new DescribeConfigurationOptionsResult();
when(mockClient.describeConfigurationOptions(dcoReq)).thenReturn(expectedDcoRes);
DescribeConfigurationOptionsResult dcoRes = setup.describeConfigurationTemplate("tempExist");
assertNotNull(dcoRes);
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElasticBeanstalkSetupTest method testDescribeConfigurationTemplateNonExistingtTemplate.
@Test
public void testDescribeConfigurationTemplateNonExistingtTemplate() {
DescribeConfigurationOptionsRequest dcoReq = new DescribeConfigurationOptionsRequest().withApplicationName(config.getElasticBeanstalkApplicationName()).withTemplateName("nonExist");
AmazonServiceException expectedAmznException = new AmazonServiceException("Invalid template name");
expectedAmznException.setErrorCode("InvalidParameterValue");
when(mockClient.describeConfigurationOptions(dcoReq)).thenThrow(expectedAmznException);
DescribeConfigurationOptionsResult dcorExpectedRes = setup.describeConfigurationTemplate("nonExist");
assertNull(dcorExpectedRes);
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElasticBeanstalkSetup method createOrUpdateConfigurationTemplate.
/**
* Create or get the Configuration template
* @return
*/
public DescribeConfigurationOptionsResult createOrUpdateConfigurationTemplate(final String templateName, final List<ConfigurationOptionSetting> cfgOptSettings) {
// Add SSL arn based on templateSuffix
DescribeConfigurationOptionsResult desc = describeConfigurationTemplate(templateName);
if (desc == null) {
logger.debug("Creating Elastic Beanstalk Template for the first time with name: " + templateName + "...");
// We need to create it
CreateConfigurationTemplateRequest request = new CreateConfigurationTemplateRequest();
request.setApplicationName(config.getElasticBeanstalkApplicationName());
request.setTemplateName(templateName);
request.setSolutionStackName(Constants.SOLUTION_STACK_NAME_64BIT_TOMCAT8_JAVA8_2017_03_AMI);
request.setOptionSettings(cfgOptSettings);
beanstalkClient.createConfigurationTemplate(request);
} else {
logger.debug("Elastic Beanstalk Template already exists so updating it with name: " + templateName + "...");
// If it exists then we want to update it
UpdateConfigurationTemplateRequest request = new UpdateConfigurationTemplateRequest();
request.setApplicationName(config.getElasticBeanstalkApplicationName());
request.setTemplateName(templateName);
request.setOptionSettings(cfgOptSettings);
UpdateConfigurationTemplateResult updateResult = beanstalkClient.updateConfigurationTemplate(request);
logger.debug(updateResult);
}
return describeConfigurationTemplate(templateName);
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElasticBeanstalkSetup method deleteConfigurationTemplate.
public void deleteConfigurationTemplate(final String templateName) {
DescribeConfigurationOptionsResult desc = describeConfigurationTemplate(templateName);
if (desc != null) {
DeleteConfigurationTemplateRequest req = new DeleteConfigurationTemplateRequest();
req.setApplicationName(config.getElasticBeanstalkApplicationName());
req.setTemplateName(templateName);
beanstalkClient.deleteConfigurationTemplate(req);
}
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElasticBeanstalkSetupTest method testUpdateConfigurationTemplate.
@Test
public void testUpdateConfigurationTemplate() {
List<ConfigurationOptionSetting> cfgOptSettings = new ArrayList<ConfigurationOptionSetting>();
String templateName = "existingTemplate";
DescribeConfigurationOptionsRequest dcoReq = new DescribeConfigurationOptionsRequest().withApplicationName(config.getElasticBeanstalkApplicationName()).withTemplateName(templateName);
DescribeConfigurationOptionsResult expectedDcoRes = new DescribeConfigurationOptionsResult();
when(mockClient.describeConfigurationOptions(dcoReq)).thenReturn(expectedDcoRes);
UpdateConfigurationTemplateRequest expectedUctReq = new UpdateConfigurationTemplateRequest();
expectedUctReq.setApplicationName(config.getElasticBeanstalkApplicationName());
expectedUctReq.setOptionSettings(cfgOptSettings);
expectedUctReq.setTemplateName(templateName);
setup.createOrUpdateConfigurationTemplate(templateName, cfgOptSettings);
verify(mockClient).updateConfigurationTemplate(expectedUctReq);
}
Aggregations