mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
feat: Adds initial Elastic Beanstalk Query API support to Floci. (#1362)
* feat: add Elastic Beanstalk query API support feat: add Elastic Beanstalk query API support * fix(elasticbeanstalk): configure native-image runtime initialization * fix(elasticbeanstalk): align missing parameter errors and add application ARN * test(elasticbeanstalk): add Java SDK compatibility coverage
This commit is contained in:
1 parent
e7b7839d85
commit
efacb37130
21 files changed
+1669
-6
No files matched your search
@@ -430,6 +430,7 @@ public interface EmulatorConfig {
|
||||
CodeDeployServiceConfig codedeploy();
|
||||
CodePipelineServiceConfig codepipeline();
|
||||
AutoScalingServiceConfig autoscaling();
|
||||
ElasticBeanstalkServiceConfig elasticbeanstalk();
|
||||
BackupServiceConfig backup();
|
||||
NeptuneServiceConfig neptune();
|
||||
DocDbServiceConfig docdb();
|
||||
@@ -501,6 +502,11 @@ public interface EmulatorConfig {
|
||||
boolean enabled();
|
||||
}
|
||||
|
||||
interface ElasticBeanstalkServiceConfig {
|
||||
@WithDefault("true")
|
||||
boolean enabled();
|
||||
}
|
||||
|
||||
interface CodeBuildServiceConfig {
|
||||
@WithDefault("true")
|
||||
boolean enabled();
|
||||
|
||||
@@ -19,6 +19,7 @@ public final class AwsNamespaces {
|
||||
public static final String EC2 = "http://ec2.amazonaws.com/doc/2016-11-15/";
|
||||
public static final String ELB_V2 = "https://elasticloadbalancing.amazonaws.com/doc/2015-12-01/";
|
||||
public static final String AUTOSCALING = "https://autoscaling.amazonaws.com/doc/2011-01-01/";
|
||||
public static final String ELASTIC_BEANSTALK = "https://elasticbeanstalk.amazonaws.com/docs/2010-12-01/";
|
||||
public static final String ROUTE53 = "https://route53.amazonaws.com/doc/2013-04-01/";
|
||||
public static final String CLOUDFRONT = "http://cloudfront.amazonaws.com/doc/2020-05-31/";
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.services.docdb.DocDbService;
|
||||
import io.github.hectorvent.floci.services.autoscaling.AutoScalingQueryHandler;
|
||||
import io.github.hectorvent.floci.services.cloudformation.CloudFormationQueryHandler;
|
||||
import io.github.hectorvent.floci.services.ec2.Ec2QueryHandler;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.ElasticBeanstalkQueryHandler;
|
||||
import io.github.hectorvent.floci.services.elbv2.ElbV2QueryHandler;
|
||||
import io.github.hectorvent.floci.services.cloudwatch.metrics.CloudWatchMetricsQueryHandler;
|
||||
import io.github.hectorvent.floci.services.cognito.CognitoJsonHandler;
|
||||
@@ -194,6 +195,7 @@ public class AwsQueryController {
|
||||
private final Ec2QueryHandler ec2QueryHandler;
|
||||
private final ElbV2QueryHandler elbV2QueryHandler;
|
||||
private final AutoScalingQueryHandler autoScalingQueryHandler;
|
||||
private final ElasticBeanstalkQueryHandler elasticBeanstalkQueryHandler;
|
||||
private final ResolvedServiceCatalog catalog;
|
||||
private final RegionResolver regionResolver;
|
||||
|
||||
@@ -213,6 +215,7 @@ public class AwsQueryController {
|
||||
Ec2QueryHandler ec2QueryHandler,
|
||||
ElbV2QueryHandler elbV2QueryHandler,
|
||||
AutoScalingQueryHandler autoScalingQueryHandler,
|
||||
ElasticBeanstalkQueryHandler elasticBeanstalkQueryHandler,
|
||||
ResolvedServiceCatalog catalog,
|
||||
RegionResolver regionResolver) {
|
||||
this.cloudFormationQueryHandler = cloudFormationQueryHandler;
|
||||
@@ -232,6 +235,7 @@ public class AwsQueryController {
|
||||
this.ec2QueryHandler = ec2QueryHandler;
|
||||
this.elbV2QueryHandler = elbV2QueryHandler;
|
||||
this.autoScalingQueryHandler = autoScalingQueryHandler;
|
||||
this.elasticBeanstalkQueryHandler = elasticBeanstalkQueryHandler;
|
||||
this.catalog = catalog;
|
||||
this.regionResolver = regionResolver;
|
||||
}
|
||||
@@ -245,6 +249,9 @@ public class AwsQueryController {
|
||||
MultivaluedMap<String, String> formParams) {
|
||||
|
||||
String action = formParams.getFirst("Action");
|
||||
if (action == null) {
|
||||
action = formParams.getFirst("Operation");
|
||||
}
|
||||
if (action == null) {
|
||||
return xmlErrorResponse("MissingAction",
|
||||
"The request must contain the parameter Action", 400);
|
||||
@@ -290,6 +297,7 @@ public class AwsQueryController {
|
||||
case "ec2" -> ec2QueryHandler.handle(action, formParams, region);
|
||||
case "elasticloadbalancing" -> elbV2QueryHandler.handle(action, formParams, region);
|
||||
case "autoscaling" -> autoScalingQueryHandler.handle(action, formParams, region);
|
||||
case "elasticbeanstalk" -> elasticBeanstalkQueryHandler.handle(action, formParams, region);
|
||||
default -> xmlErrorResponse("UnknownService",
|
||||
"Unknown or unsupported service: " + service, 400);
|
||||
};
|
||||
@@ -329,6 +337,13 @@ public class AwsQueryController {
|
||||
"ListTagsForResource", "TagResource", "UntagResource"
|
||||
);
|
||||
|
||||
private static final Set<String> ELASTIC_BEANSTALK_ACTIONS = Set.of(
|
||||
"CreateApplication", "DescribeApplications", "UpdateApplication", "DeleteApplication",
|
||||
"CreateApplicationVersion", "DescribeApplicationVersions", "DeleteApplicationVersion",
|
||||
"CreateEnvironment", "DescribeEnvironments", "UpdateEnvironment", "TerminateEnvironment",
|
||||
"DescribeConfigurationSettings", "CheckDNSAvailability", "ListAvailableSolutionStacks"
|
||||
);
|
||||
|
||||
private static final Set<String> RDS_ACTIONS = Set.of(
|
||||
"CreateDBInstance", "DescribeDBInstances", "DeleteDBInstance",
|
||||
"ModifyDBInstance", "RebootDBInstance",
|
||||
@@ -437,6 +452,9 @@ public class AwsQueryController {
|
||||
if (AUTOSCALING_ACTIONS.contains(action)) {
|
||||
return "autoscaling";
|
||||
}
|
||||
if (ELASTIC_BEANSTALK_ACTIONS.contains(action)) {
|
||||
return "elasticbeanstalk";
|
||||
}
|
||||
// SQS actions are numerous and not enumerated — fall back to sqs only for
|
||||
// requests that arrived without an Authorization header (raw/test clients)
|
||||
return "sqs";
|
||||
|
||||
@@ -285,6 +285,12 @@ public class ResolvedServiceCatalog {
|
||||
"autoscaling", config.storage().mode(), 5000L, AwsNamespaces.AUTOSCALING, ServiceProtocol.QUERY,
|
||||
protocols(ServiceProtocol.QUERY),
|
||||
Set.of(), Set.of("autoscaling"), Set.of(), Set.of()),
|
||||
descriptor("elasticbeanstalk", "elasticbeanstalk",
|
||||
config.services().elasticbeanstalk().enabled(), true,
|
||||
"elasticbeanstalk", config.storage().mode(), 5000L,
|
||||
AwsNamespaces.ELASTIC_BEANSTALK, ServiceProtocol.QUERY,
|
||||
protocols(ServiceProtocol.QUERY),
|
||||
Set.of(), Set.of("elasticbeanstalk"), Set.of(), Set.of()),
|
||||
descriptor("backup", "backup", config.services().backup().enabled(), true,
|
||||
"backup", storageMode(config.storage().services().backup().mode(), config.storage().mode()),
|
||||
config.storage().services().backup().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
|
||||
|
||||
+329
@@ -0,0 +1,329 @@
|
||||
package io.github.hectorvent.floci.services.elasticbeanstalk;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.AwsNamespaces;
|
||||
import io.github.hectorvent.floci.core.common.AwsQueryResponse;
|
||||
import io.github.hectorvent.floci.core.common.XmlBuilder;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.BeanstalkApplication;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.BeanstalkApplicationVersion;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.BeanstalkEnvironment;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.ConfigurationOptionSetting;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.MultivaluedMap;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ApplicationScoped
|
||||
public class ElasticBeanstalkQueryHandler {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ElasticBeanstalkQueryHandler.class);
|
||||
private static final String NS = AwsNamespaces.ELASTIC_BEANSTALK;
|
||||
private static final DateTimeFormatter ISO_FMT =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(ZoneOffset.UTC);
|
||||
|
||||
private final ElasticBeanstalkService service;
|
||||
|
||||
@Inject
|
||||
ElasticBeanstalkQueryHandler(ElasticBeanstalkService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public Response handle(String action, MultivaluedMap<String, String> p, String region) {
|
||||
LOG.debugv("Elastic Beanstalk action: {0}", action);
|
||||
try {
|
||||
return switch (action) {
|
||||
case "CreateApplication" -> createApplication(p, region);
|
||||
case "DescribeApplications" -> describeApplications(p, region);
|
||||
case "UpdateApplication" -> updateApplication(p, region);
|
||||
case "DeleteApplication" -> deleteApplication(p, region);
|
||||
case "CreateApplicationVersion" -> createApplicationVersion(p, region);
|
||||
case "DescribeApplicationVersions" -> describeApplicationVersions(p, region);
|
||||
case "DeleteApplicationVersion" -> deleteApplicationVersion(p, region);
|
||||
case "CreateEnvironment" -> createEnvironment(p, region);
|
||||
case "DescribeEnvironments" -> describeEnvironments(p, region);
|
||||
case "UpdateEnvironment" -> updateEnvironment(p, region);
|
||||
case "TerminateEnvironment" -> terminateEnvironment(p, region);
|
||||
case "DescribeConfigurationSettings" -> describeConfigurationSettings(p, region);
|
||||
case "CheckDNSAvailability" -> checkDnsAvailability(p, region);
|
||||
case "ListAvailableSolutionStacks" -> listAvailableSolutionStacks();
|
||||
default -> AwsQueryResponse.error("UnsupportedOperation",
|
||||
"Operation " + action + " is not supported.", NS, 400);
|
||||
};
|
||||
} catch (AwsException e) {
|
||||
return AwsQueryResponse.error(e.getErrorCode(), e.getMessage(), NS, e.getHttpStatus());
|
||||
} catch (Exception e) {
|
||||
LOG.errorv(e, "Unexpected error in Elastic Beanstalk {0}", action);
|
||||
return AwsQueryResponse.error("InternalFailure", e.getMessage(), NS, 500);
|
||||
}
|
||||
}
|
||||
|
||||
private Response createApplication(MultivaluedMap<String, String> p, String region) {
|
||||
BeanstalkApplication app = service.createApplication(region, p.getFirst("ApplicationName"),
|
||||
p.getFirst("Description"), parseTags(p));
|
||||
return ok(AwsQueryResponse.envelope("CreateApplication", NS,
|
||||
new XmlBuilder().start("Application").raw(applicationInnerXml(app)).end("Application").build()));
|
||||
}
|
||||
|
||||
private Response describeApplications(MultivaluedMap<String, String> p, String region) {
|
||||
XmlBuilder xml = new XmlBuilder().start("Applications");
|
||||
for (BeanstalkApplication app : service.describeApplications(region, memberList(p, "ApplicationNames"))) {
|
||||
xml.start("member").raw(applicationInnerXml(app)).end("member");
|
||||
}
|
||||
xml.end("Applications");
|
||||
return ok(AwsQueryResponse.envelope("DescribeApplications", NS, xml.build()));
|
||||
}
|
||||
|
||||
private Response updateApplication(MultivaluedMap<String, String> p, String region) {
|
||||
BeanstalkApplication app = service.updateApplication(region, p.getFirst("ApplicationName"),
|
||||
p.getFirst("Description"));
|
||||
return ok(AwsQueryResponse.envelope("UpdateApplication", NS,
|
||||
new XmlBuilder().start("Application").raw(applicationInnerXml(app)).end("Application").build()));
|
||||
}
|
||||
|
||||
private Response deleteApplication(MultivaluedMap<String, String> p, String region) {
|
||||
service.deleteApplication(region, p.getFirst("ApplicationName"),
|
||||
"true".equalsIgnoreCase(p.getFirst("TerminateEnvByForce")));
|
||||
return ok(AwsQueryResponse.envelopeEmptyResult("DeleteApplication", NS));
|
||||
}
|
||||
|
||||
private Response createApplicationVersion(MultivaluedMap<String, String> p, String region) {
|
||||
BeanstalkApplicationVersion version = service.createApplicationVersion(region,
|
||||
p.getFirst("ApplicationName"),
|
||||
p.getFirst("VersionLabel"),
|
||||
p.getFirst("Description"),
|
||||
"true".equalsIgnoreCase(p.getFirst("AutoCreateApplication")),
|
||||
p.getFirst("SourceBundle.S3Bucket"),
|
||||
p.getFirst("SourceBundle.S3Key"),
|
||||
parseTags(p));
|
||||
return ok(AwsQueryResponse.envelope("CreateApplicationVersion", NS,
|
||||
new XmlBuilder().start("ApplicationVersion")
|
||||
.raw(applicationVersionInnerXml(version))
|
||||
.end("ApplicationVersion").build()));
|
||||
}
|
||||
|
||||
private Response describeApplicationVersions(MultivaluedMap<String, String> p, String region) {
|
||||
XmlBuilder xml = new XmlBuilder().start("ApplicationVersions");
|
||||
for (BeanstalkApplicationVersion version : service.describeApplicationVersions(region,
|
||||
p.getFirst("ApplicationName"), memberList(p, "VersionLabels"))) {
|
||||
xml.start("member").raw(applicationVersionInnerXml(version)).end("member");
|
||||
}
|
||||
xml.end("ApplicationVersions");
|
||||
return ok(AwsQueryResponse.envelope("DescribeApplicationVersions", NS, xml.build()));
|
||||
}
|
||||
|
||||
private Response deleteApplicationVersion(MultivaluedMap<String, String> p, String region) {
|
||||
service.deleteApplicationVersion(region, p.getFirst("ApplicationName"), p.getFirst("VersionLabel"));
|
||||
return ok(AwsQueryResponse.envelopeEmptyResult("DeleteApplicationVersion", NS));
|
||||
}
|
||||
|
||||
private Response createEnvironment(MultivaluedMap<String, String> p, String region) {
|
||||
BeanstalkEnvironment env = service.createEnvironment(region,
|
||||
p.getFirst("ApplicationName"),
|
||||
p.getFirst("EnvironmentName"),
|
||||
p.getFirst("Description"),
|
||||
p.getFirst("CNAMEPrefix"),
|
||||
p.getFirst("SolutionStackName"),
|
||||
p.getFirst("PlatformArn"),
|
||||
p.getFirst("TemplateName"),
|
||||
p.getFirst("VersionLabel"),
|
||||
parseOptionSettings(p),
|
||||
parseTags(p));
|
||||
return ok(AwsQueryResponse.envelope("CreateEnvironment", NS, environmentInnerXml(env)));
|
||||
}
|
||||
|
||||
private Response describeEnvironments(MultivaluedMap<String, String> p, String region) {
|
||||
XmlBuilder xml = new XmlBuilder().start("Environments");
|
||||
for (BeanstalkEnvironment env : service.describeEnvironments(region,
|
||||
p.getFirst("ApplicationName"),
|
||||
memberList(p, "EnvironmentNames"),
|
||||
memberList(p, "EnvironmentIds"),
|
||||
p.getFirst("VersionLabel"),
|
||||
"true".equalsIgnoreCase(p.getFirst("IncludeDeleted")))) {
|
||||
xml.start("member").raw(environmentInnerXml(env)).end("member");
|
||||
}
|
||||
xml.end("Environments");
|
||||
return ok(AwsQueryResponse.envelope("DescribeEnvironments", NS, xml.build()));
|
||||
}
|
||||
|
||||
private Response updateEnvironment(MultivaluedMap<String, String> p, String region) {
|
||||
BeanstalkEnvironment env = service.updateEnvironment(region,
|
||||
p.getFirst("EnvironmentName"),
|
||||
p.getFirst("EnvironmentId"),
|
||||
p.getFirst("Description"),
|
||||
p.getFirst("VersionLabel"),
|
||||
p.getFirst("SolutionStackName"),
|
||||
p.getFirst("PlatformArn"),
|
||||
parseOptionSettings(p));
|
||||
return ok(AwsQueryResponse.envelope("UpdateEnvironment", NS, environmentInnerXml(env)));
|
||||
}
|
||||
|
||||
private Response terminateEnvironment(MultivaluedMap<String, String> p, String region) {
|
||||
BeanstalkEnvironment env = service.terminateEnvironment(region,
|
||||
p.getFirst("EnvironmentName"), p.getFirst("EnvironmentId"));
|
||||
return ok(AwsQueryResponse.envelope("TerminateEnvironment", NS, environmentInnerXml(env)));
|
||||
}
|
||||
|
||||
private Response describeConfigurationSettings(MultivaluedMap<String, String> p, String region) {
|
||||
List<ConfigurationOptionSetting> settings = service.describeConfigurationSettings(region,
|
||||
p.getFirst("ApplicationName"), p.getFirst("EnvironmentName"), p.getFirst("TemplateName"));
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.start("ConfigurationSettings")
|
||||
.start("member")
|
||||
.elem("ApplicationName", p.getFirst("ApplicationName"))
|
||||
.elem("EnvironmentName", p.getFirst("EnvironmentName"))
|
||||
.elem("TemplateName", p.getFirst("TemplateName"))
|
||||
.elem("DeploymentStatus", "deployed")
|
||||
.start("OptionSettings");
|
||||
appendOptionSettings(xml, settings);
|
||||
xml.end("OptionSettings").end("member").end("ConfigurationSettings");
|
||||
return ok(AwsQueryResponse.envelope("DescribeConfigurationSettings", NS, xml.build()));
|
||||
}
|
||||
|
||||
private Response checkDnsAvailability(MultivaluedMap<String, String> p, String region) {
|
||||
String cnamePrefix = p.getFirst("CNAMEPrefix");
|
||||
boolean available = service.isCnameAvailable(cnamePrefix, region);
|
||||
String result = new XmlBuilder()
|
||||
.elem("Available", available)
|
||||
.elem("FullyQualifiedCNAME", cnamePrefix + ".elasticbeanstalk.local")
|
||||
.build();
|
||||
return ok(AwsQueryResponse.envelope("CheckDNSAvailability", NS, result));
|
||||
}
|
||||
|
||||
private Response listAvailableSolutionStacks() {
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.start("SolutionStacks");
|
||||
for (String stack : service.listAvailableSolutionStacks()) {
|
||||
xml.elem("member", stack);
|
||||
}
|
||||
xml.end("SolutionStacks").start("SolutionStackDetails").end("SolutionStackDetails");
|
||||
return ok(AwsQueryResponse.envelope("ListAvailableSolutionStacks", NS, xml.build()));
|
||||
}
|
||||
|
||||
private static String applicationInnerXml(BeanstalkApplication app) {
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.elem("ApplicationName", app.getApplicationName())
|
||||
.elem("ApplicationArn", app.getApplicationArn())
|
||||
.elem("Description", app.getDescription())
|
||||
.elem("DateCreated", ISO_FMT.format(app.getDateCreated()))
|
||||
.elem("DateUpdated", ISO_FMT.format(app.getDateUpdated()))
|
||||
.start("Versions");
|
||||
for (String version : app.getVersions()) {
|
||||
xml.elem("member", version);
|
||||
}
|
||||
xml.end("Versions").start("ConfigurationTemplates");
|
||||
for (String template : app.getConfigurationTemplates()) {
|
||||
xml.elem("member", template);
|
||||
}
|
||||
return xml.end("ConfigurationTemplates").build();
|
||||
}
|
||||
|
||||
private static String applicationVersionInnerXml(BeanstalkApplicationVersion version) {
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.elem("ApplicationName", version.getApplicationName())
|
||||
.elem("VersionLabel", version.getVersionLabel())
|
||||
.elem("Description", version.getDescription())
|
||||
.elem("DateCreated", ISO_FMT.format(version.getDateCreated()))
|
||||
.elem("DateUpdated", ISO_FMT.format(version.getDateUpdated()))
|
||||
.elem("Status", version.getStatus());
|
||||
if (version.getSourceBundleBucket() != null || version.getSourceBundleKey() != null) {
|
||||
xml.start("SourceBundle")
|
||||
.elem("S3Bucket", version.getSourceBundleBucket())
|
||||
.elem("S3Key", version.getSourceBundleKey())
|
||||
.end("SourceBundle");
|
||||
}
|
||||
return xml.build();
|
||||
}
|
||||
|
||||
private static String environmentInnerXml(BeanstalkEnvironment env) {
|
||||
return new XmlBuilder()
|
||||
.elem("EnvironmentName", env.getEnvironmentName())
|
||||
.elem("EnvironmentId", env.getEnvironmentId())
|
||||
.elem("EnvironmentArn", env.getEnvironmentArn())
|
||||
.elem("ApplicationName", env.getApplicationName())
|
||||
.elem("VersionLabel", env.getVersionLabel())
|
||||
.elem("SolutionStackName", env.getSolutionStackName())
|
||||
.elem("PlatformArn", env.getPlatformArn())
|
||||
.elem("TemplateName", env.getTemplateName())
|
||||
.elem("Description", env.getDescription())
|
||||
.elem("EndpointURL", env.getEndpointUrl())
|
||||
.elem("CNAME", env.getCname())
|
||||
.elem("Status", env.getStatus())
|
||||
.elem("Health", env.getHealth())
|
||||
.elem("HealthStatus", env.getHealthStatus())
|
||||
.elem("AbortableOperationInProgress", false)
|
||||
.elem("DateCreated", ISO_FMT.format(env.getDateCreated()))
|
||||
.elem("DateUpdated", ISO_FMT.format(env.getDateUpdated()))
|
||||
.start("Tier")
|
||||
.elem("Name", "WebServer")
|
||||
.elem("Type", "Standard")
|
||||
.elem("Version", "1.0")
|
||||
.end("Tier")
|
||||
.build();
|
||||
}
|
||||
|
||||
private static void appendOptionSettings(XmlBuilder xml, List<ConfigurationOptionSetting> settings) {
|
||||
for (ConfigurationOptionSetting setting : settings) {
|
||||
xml.start("member")
|
||||
.elem("Namespace", setting.getNamespace())
|
||||
.elem("OptionName", setting.getOptionName())
|
||||
.elem("ResourceName", setting.getResourceName())
|
||||
.elem("Value", setting.getValue())
|
||||
.end("member");
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> memberList(MultivaluedMap<String, String> p, String prefix) {
|
||||
List<String> values = new ArrayList<>();
|
||||
for (int i = 1; ; i++) {
|
||||
String value = p.getFirst(prefix + ".member." + i);
|
||||
if (value == null) {
|
||||
break;
|
||||
}
|
||||
values.add(value);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private static Map<String, String> parseTags(MultivaluedMap<String, String> p) {
|
||||
Map<String, String> tags = new LinkedHashMap<>();
|
||||
for (int i = 1; ; i++) {
|
||||
String key = p.getFirst("Tags.member." + i + ".Key");
|
||||
String value = p.getFirst("Tags.member." + i + ".Value");
|
||||
if (key == null && value == null) {
|
||||
break;
|
||||
}
|
||||
if (key != null) {
|
||||
tags.put(key, value != null ? value : "");
|
||||
}
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
private static List<ConfigurationOptionSetting> parseOptionSettings(MultivaluedMap<String, String> p) {
|
||||
List<ConfigurationOptionSetting> settings = new ArrayList<>();
|
||||
for (int i = 1; ; i++) {
|
||||
String prefix = "OptionSettings.member." + i + ".";
|
||||
String namespace = p.getFirst(prefix + "Namespace");
|
||||
String optionName = p.getFirst(prefix + "OptionName");
|
||||
String resourceName = p.getFirst(prefix + "ResourceName");
|
||||
String value = p.getFirst(prefix + "Value");
|
||||
if (namespace == null && optionName == null && resourceName == null && value == null) {
|
||||
break;
|
||||
}
|
||||
settings.add(new ConfigurationOptionSetting(namespace, optionName, resourceName, value));
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
private static Response ok(String xml) {
|
||||
return Response.ok(xml).build();
|
||||
}
|
||||
}
|
||||
+418
@@ -0,0 +1,418 @@
|
||||
package io.github.hectorvent.floci.services.elasticbeanstalk;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.BeanstalkApplication;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.BeanstalkApplicationVersion;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.BeanstalkEnvironment;
|
||||
import io.github.hectorvent.floci.services.elasticbeanstalk.model.ConfigurationOptionSetting;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@ApplicationScoped
|
||||
public class ElasticBeanstalkService {
|
||||
|
||||
private static final SecureRandom RANDOM = new SecureRandom();
|
||||
private static final String LOWER_ALNUM = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
private static final String DEFAULT_SOLUTION_STACK =
|
||||
"64bit Amazon Linux 2023 v4.3.0 running Docker";
|
||||
|
||||
private final RegionResolver regionResolver;
|
||||
private final Map<String, BeanstalkApplication> applications = new ConcurrentHashMap<>();
|
||||
private final Map<String, BeanstalkApplicationVersion> versions = new ConcurrentHashMap<>();
|
||||
private final Map<String, BeanstalkEnvironment> environments = new ConcurrentHashMap<>();
|
||||
|
||||
@Inject
|
||||
ElasticBeanstalkService(RegionResolver regionResolver) {
|
||||
this.regionResolver = regionResolver;
|
||||
}
|
||||
|
||||
public BeanstalkApplication createApplication(String region, String name, String description,
|
||||
Map<String, String> tags) {
|
||||
requireName(name, "ApplicationName");
|
||||
String key = appKey(region, name);
|
||||
if (applications.containsKey(key)) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Application " + name + " already exists.", 400);
|
||||
}
|
||||
Instant now = Instant.now();
|
||||
BeanstalkApplication app = new BeanstalkApplication();
|
||||
app.setApplicationName(name);
|
||||
app.setApplicationArn(regionResolver.buildArn("elasticbeanstalk", region, "application/" + name));
|
||||
app.setDescription(description);
|
||||
app.setDateCreated(now);
|
||||
app.setDateUpdated(now);
|
||||
app.getConfigurationTemplates().add("default");
|
||||
app.getTags().putAll(tags);
|
||||
applications.put(key, app);
|
||||
return app;
|
||||
}
|
||||
|
||||
public Collection<BeanstalkApplication> describeApplications(String region, List<String> names) {
|
||||
if (names != null && !names.isEmpty()) {
|
||||
List<BeanstalkApplication> result = new ArrayList<>();
|
||||
for (String name : names) {
|
||||
BeanstalkApplication app = applications.get(appKey(region, name));
|
||||
if (app != null) {
|
||||
result.add(app);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return applications.entrySet().stream()
|
||||
.filter(e -> e.getKey().startsWith(region + "::"))
|
||||
.map(Map.Entry::getValue)
|
||||
.sorted(Comparator.comparing(BeanstalkApplication::getApplicationName))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public BeanstalkApplication updateApplication(String region, String name, String description) {
|
||||
BeanstalkApplication app = requireApplication(region, name);
|
||||
if (description != null) {
|
||||
app.setDescription(description);
|
||||
}
|
||||
app.setDateUpdated(Instant.now());
|
||||
return app;
|
||||
}
|
||||
|
||||
public void deleteApplication(String region, String name, boolean terminateEnvByForce) {
|
||||
requireApplication(region, name);
|
||||
List<BeanstalkEnvironment> activeEnvironments = environments.entrySet().stream()
|
||||
.filter(e -> e.getKey().startsWith(region + "::"))
|
||||
.map(Map.Entry::getValue)
|
||||
.filter(env -> name.equals(env.getApplicationName()))
|
||||
.filter(env -> !"Terminated".equals(env.getStatus()))
|
||||
.toList();
|
||||
if (!activeEnvironments.isEmpty() && !terminateEnvByForce) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Application " + name + " has active environments.", 400);
|
||||
}
|
||||
for (BeanstalkEnvironment env : activeEnvironments) {
|
||||
terminateEnvironment(region, env.getEnvironmentName(), env.getEnvironmentId());
|
||||
}
|
||||
applications.remove(appKey(region, name));
|
||||
versions.entrySet().removeIf(e -> e.getKey().startsWith(versionPrefix(region, name)));
|
||||
}
|
||||
|
||||
public BeanstalkApplicationVersion createApplicationVersion(String region, String applicationName,
|
||||
String versionLabel, String description,
|
||||
boolean autoCreateApplication,
|
||||
String sourceBundleBucket,
|
||||
String sourceBundleKey,
|
||||
Map<String, String> tags) {
|
||||
requireName(applicationName, "ApplicationName");
|
||||
requireName(versionLabel, "VersionLabel");
|
||||
BeanstalkApplication app = applications.get(appKey(region, applicationName));
|
||||
if (app == null && autoCreateApplication) {
|
||||
app = createApplication(region, applicationName, null, Map.of());
|
||||
}
|
||||
if (app == null) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"No Application named " + applicationName + " found.", 400);
|
||||
}
|
||||
String key = versionKey(region, applicationName, versionLabel);
|
||||
if (versions.containsKey(key)) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Application Version " + versionLabel + " already exists.", 400);
|
||||
}
|
||||
Instant now = Instant.now();
|
||||
BeanstalkApplicationVersion version = new BeanstalkApplicationVersion();
|
||||
version.setApplicationName(applicationName);
|
||||
version.setVersionLabel(versionLabel);
|
||||
version.setDescription(description);
|
||||
version.setSourceBundleBucket(sourceBundleBucket);
|
||||
version.setSourceBundleKey(sourceBundleKey);
|
||||
version.setDateCreated(now);
|
||||
version.setDateUpdated(now);
|
||||
version.setStatus("Processed");
|
||||
version.getTags().putAll(tags);
|
||||
versions.put(key, version);
|
||||
app.getVersions().add(versionLabel);
|
||||
app.setDateUpdated(now);
|
||||
return version;
|
||||
}
|
||||
|
||||
public Collection<BeanstalkApplicationVersion> describeApplicationVersions(String region,
|
||||
String applicationName,
|
||||
List<String> labels) {
|
||||
return versions.entrySet().stream()
|
||||
.filter(e -> e.getKey().startsWith(region + "::"))
|
||||
.map(Map.Entry::getValue)
|
||||
.filter(version -> applicationName == null || applicationName.equals(version.getApplicationName()))
|
||||
.filter(version -> labels == null || labels.isEmpty() || labels.contains(version.getVersionLabel()))
|
||||
.sorted(Comparator.comparing(BeanstalkApplicationVersion::getApplicationName)
|
||||
.thenComparing(BeanstalkApplicationVersion::getVersionLabel))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public void deleteApplicationVersion(String region, String applicationName, String versionLabel) {
|
||||
requireName(applicationName, "ApplicationName");
|
||||
requireName(versionLabel, "VersionLabel");
|
||||
BeanstalkApplicationVersion removed = versions.remove(versionKey(region, applicationName, versionLabel));
|
||||
if (removed == null) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"No Application Version named " + versionLabel + " found.", 400);
|
||||
}
|
||||
BeanstalkApplication app = applications.get(appKey(region, applicationName));
|
||||
if (app != null) {
|
||||
app.getVersions().remove(versionLabel);
|
||||
app.setDateUpdated(Instant.now());
|
||||
}
|
||||
}
|
||||
|
||||
public BeanstalkEnvironment createEnvironment(String region, String applicationName, String environmentName,
|
||||
String description, String cnamePrefix, String solutionStackName,
|
||||
String platformArn, String templateName, String versionLabel,
|
||||
List<ConfigurationOptionSetting> optionSettings,
|
||||
Map<String, String> tags) {
|
||||
requireApplication(region, applicationName);
|
||||
if (environmentName == null || environmentName.isBlank()) {
|
||||
environmentName = generatedEnvironmentName(applicationName);
|
||||
}
|
||||
validateEnvironmentName(environmentName);
|
||||
if (environments.containsKey(envKey(region, environmentName))) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Environment " + environmentName + " already exists.", 400);
|
||||
}
|
||||
if (versionLabel != null && !versions.containsKey(versionKey(region, applicationName, versionLabel))) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"No Application Version named " + versionLabel + " found.", 400);
|
||||
}
|
||||
|
||||
Instant now = Instant.now();
|
||||
String envId = "e-" + randomLower(10);
|
||||
BeanstalkEnvironment env = new BeanstalkEnvironment();
|
||||
env.setApplicationName(applicationName);
|
||||
env.setEnvironmentId(envId);
|
||||
env.setEnvironmentName(environmentName);
|
||||
env.setEnvironmentArn(regionResolver.buildArn("elasticbeanstalk", region,
|
||||
"environment/" + applicationName + "/" + environmentName));
|
||||
env.setDescription(description);
|
||||
env.setCname(cname(cnamePrefix, environmentName));
|
||||
env.setEndpointUrl("awseb-" + envId + "." + region + ".elasticbeanstalk.local");
|
||||
env.setSolutionStackName(firstNonBlank(solutionStackName, DEFAULT_SOLUTION_STACK));
|
||||
env.setPlatformArn(platformArn);
|
||||
env.setTemplateName(templateName);
|
||||
env.setVersionLabel(versionLabel);
|
||||
env.setStatus("Ready");
|
||||
env.setHealth("Green");
|
||||
env.setHealthStatus("Ok");
|
||||
env.setDateCreated(now);
|
||||
env.setDateUpdated(now);
|
||||
env.getOptionSettings().addAll(optionSettings);
|
||||
env.getTags().putAll(tags);
|
||||
environments.put(envKey(region, environmentName), env);
|
||||
return env;
|
||||
}
|
||||
|
||||
public Collection<BeanstalkEnvironment> describeEnvironments(String region, String applicationName,
|
||||
List<String> environmentNames,
|
||||
List<String> environmentIds,
|
||||
String versionLabel,
|
||||
boolean includeDeleted) {
|
||||
Set<String> names = environmentNames == null ? Set.of() : Set.copyOf(environmentNames);
|
||||
Set<String> ids = environmentIds == null ? Set.of() : Set.copyOf(environmentIds);
|
||||
return environments.entrySet().stream()
|
||||
.filter(e -> e.getKey().startsWith(region + "::"))
|
||||
.map(Map.Entry::getValue)
|
||||
.filter(env -> applicationName == null || applicationName.equals(env.getApplicationName()))
|
||||
.filter(env -> names.isEmpty() || names.contains(env.getEnvironmentName()))
|
||||
.filter(env -> ids.isEmpty() || ids.contains(env.getEnvironmentId()))
|
||||
.filter(env -> versionLabel == null || versionLabel.equals(env.getVersionLabel()))
|
||||
.filter(env -> includeDeleted || !"Terminated".equals(env.getStatus()))
|
||||
.sorted(Comparator.comparing(BeanstalkEnvironment::getEnvironmentName))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public BeanstalkEnvironment updateEnvironment(String region, String environmentName, String environmentId,
|
||||
String description, String versionLabel,
|
||||
String solutionStackName, String platformArn,
|
||||
List<ConfigurationOptionSetting> optionSettings) {
|
||||
BeanstalkEnvironment env = requireEnvironment(region, environmentName, environmentId);
|
||||
if ("Terminated".equals(env.getStatus())) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Environment " + env.getEnvironmentName() + " is terminated.", 400);
|
||||
}
|
||||
if (versionLabel != null && !versions.containsKey(versionKey(region, env.getApplicationName(), versionLabel))) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"No Application Version named " + versionLabel + " found.", 400);
|
||||
}
|
||||
if (description != null) {
|
||||
env.setDescription(description);
|
||||
}
|
||||
if (versionLabel != null) {
|
||||
env.setVersionLabel(versionLabel);
|
||||
}
|
||||
if (solutionStackName != null) {
|
||||
env.setSolutionStackName(solutionStackName);
|
||||
}
|
||||
if (platformArn != null) {
|
||||
env.setPlatformArn(platformArn);
|
||||
}
|
||||
if (!optionSettings.isEmpty()) {
|
||||
mergeOptionSettings(env.getOptionSettings(), optionSettings);
|
||||
}
|
||||
env.setStatus("Ready");
|
||||
env.setHealth("Green");
|
||||
env.setHealthStatus("Ok");
|
||||
env.setDateUpdated(Instant.now());
|
||||
return env;
|
||||
}
|
||||
|
||||
public BeanstalkEnvironment terminateEnvironment(String region, String environmentName, String environmentId) {
|
||||
BeanstalkEnvironment env = requireEnvironment(region, environmentName, environmentId);
|
||||
env.setStatus("Terminated");
|
||||
env.setHealth("Grey");
|
||||
env.setHealthStatus("NoData");
|
||||
env.setDateUpdated(Instant.now());
|
||||
return env;
|
||||
}
|
||||
|
||||
public List<ConfigurationOptionSetting> describeConfigurationSettings(String region, String applicationName,
|
||||
String environmentName,
|
||||
String templateName) {
|
||||
requireApplication(region, applicationName);
|
||||
if ((environmentName == null || environmentName.isBlank()) && (templateName == null || templateName.isBlank())) {
|
||||
throw new AwsException("MissingParameter",
|
||||
"Either EnvironmentName or TemplateName must be specified.", 400);
|
||||
}
|
||||
if (environmentName != null && templateName != null) {
|
||||
throw new AwsException("InvalidParameterCombination",
|
||||
"EnvironmentName and TemplateName cannot both be specified.", 400);
|
||||
}
|
||||
if (environmentName != null) {
|
||||
return List.copyOf(requireEnvironment(region, environmentName, null).getOptionSettings());
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
public boolean isCnameAvailable(String cnamePrefix, String region) {
|
||||
requireName(cnamePrefix, "CNAMEPrefix");
|
||||
String candidate = cname(cnamePrefix, cnamePrefix);
|
||||
return environments.entrySet().stream()
|
||||
.filter(e -> e.getKey().startsWith(region + "::"))
|
||||
.map(Map.Entry::getValue)
|
||||
.noneMatch(env -> candidate.equals(env.getCname()));
|
||||
}
|
||||
|
||||
public List<String> listAvailableSolutionStacks() {
|
||||
return List.of(
|
||||
DEFAULT_SOLUTION_STACK,
|
||||
"64bit Amazon Linux 2023 v4.4.0 running Corretto 21",
|
||||
"64bit Amazon Linux 2023 v4.4.0 running Python 3.13",
|
||||
"64bit Amazon Linux 2023 v6.5.0 running Node.js 22"
|
||||
);
|
||||
}
|
||||
|
||||
private BeanstalkApplication requireApplication(String region, String name) {
|
||||
requireName(name, "ApplicationName");
|
||||
BeanstalkApplication app = applications.get(appKey(region, name));
|
||||
if (app == null) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"No Application named " + name + " found.", 400);
|
||||
}
|
||||
return app;
|
||||
}
|
||||
|
||||
private BeanstalkEnvironment requireEnvironment(String region, String environmentName, String environmentId) {
|
||||
if ((environmentName == null || environmentName.isBlank()) && (environmentId == null || environmentId.isBlank())) {
|
||||
throw new AwsException("MissingParameter",
|
||||
"Either EnvironmentName or EnvironmentId must be specified.", 400);
|
||||
}
|
||||
if (environmentName != null && !environmentName.isBlank()) {
|
||||
BeanstalkEnvironment env = environments.get(envKey(region, environmentName));
|
||||
if (env != null && (environmentId == null || environmentId.equals(env.getEnvironmentId()))) {
|
||||
return env;
|
||||
}
|
||||
}
|
||||
if (environmentId != null && !environmentId.isBlank()) {
|
||||
return environments.entrySet().stream()
|
||||
.filter(e -> e.getKey().startsWith(region + "::"))
|
||||
.map(Map.Entry::getValue)
|
||||
.filter(env -> environmentId.equals(env.getEnvironmentId()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new AwsException("InvalidParameterValue",
|
||||
"No Environment found for id " + environmentId + ".", 400));
|
||||
}
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"No Environment named " + environmentName + " found.", 400);
|
||||
}
|
||||
|
||||
private void mergeOptionSettings(List<ConfigurationOptionSetting> existing,
|
||||
List<ConfigurationOptionSetting> incoming) {
|
||||
for (ConfigurationOptionSetting next : incoming) {
|
||||
existing.removeIf(setting -> Objects.equals(setting.getNamespace(), next.getNamespace())
|
||||
&& Objects.equals(setting.getOptionName(), next.getOptionName())
|
||||
&& Objects.equals(setting.getResourceName(), next.getResourceName()));
|
||||
existing.add(next);
|
||||
}
|
||||
}
|
||||
|
||||
private static void requireName(String value, String field) {
|
||||
if (value == null || value.isBlank()) {
|
||||
throw new AwsException("MissingParameter", field + " is required.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private static void validateEnvironmentName(String name) {
|
||||
if (name.length() < 4 || name.length() > 40 || name.startsWith("-") || name.endsWith("-")
|
||||
|| !name.matches("[A-Za-z0-9-]+")) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"EnvironmentName must be 4 to 40 characters and contain only letters, numbers, and hyphens.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private static String generatedEnvironmentName(String applicationName) {
|
||||
String base = applicationName.replaceAll("[^A-Za-z0-9-]", "-");
|
||||
if (base.length() > 27) {
|
||||
base = base.substring(0, 27);
|
||||
}
|
||||
return base + "-" + randomLower(8);
|
||||
}
|
||||
|
||||
private static String cname(String cnamePrefix, String environmentName) {
|
||||
String prefix = firstNonBlank(cnamePrefix, environmentName);
|
||||
return prefix + ".elasticbeanstalk.local";
|
||||
}
|
||||
|
||||
private static String firstNonBlank(String first, String fallback) {
|
||||
return first == null || first.isBlank() ? fallback : first;
|
||||
}
|
||||
|
||||
private static String randomLower(int length) {
|
||||
StringBuilder result = new StringBuilder(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
result.append(LOWER_ALNUM.charAt(RANDOM.nextInt(LOWER_ALNUM.length())));
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static String appKey(String region, String name) {
|
||||
return region + "::" + name;
|
||||
}
|
||||
|
||||
private static String versionPrefix(String region, String applicationName) {
|
||||
return region + "::" + applicationName + "::";
|
||||
}
|
||||
|
||||
private static String versionKey(String region, String applicationName, String versionLabel) {
|
||||
return versionPrefix(region, applicationName) + versionLabel;
|
||||
}
|
||||
|
||||
private static String envKey(String region, String environmentName) {
|
||||
return region + "::" + environmentName;
|
||||
}
|
||||
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package io.github.hectorvent.floci.services.elasticbeanstalk.model;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeanstalkApplication {
|
||||
|
||||
private String applicationName;
|
||||
private String applicationArn;
|
||||
private String description;
|
||||
private Instant dateCreated;
|
||||
private Instant dateUpdated;
|
||||
private final List<String> versions = new ArrayList<>();
|
||||
private final List<String> configurationTemplates = new ArrayList<>();
|
||||
private final Map<String, String> tags = new LinkedHashMap<>();
|
||||
|
||||
public String getApplicationName() {
|
||||
return applicationName;
|
||||
}
|
||||
|
||||
public void setApplicationName(String applicationName) {
|
||||
this.applicationName = applicationName;
|
||||
}
|
||||
|
||||
public String getApplicationArn() {
|
||||
return applicationArn;
|
||||
}
|
||||
|
||||
public void setApplicationArn(String applicationArn) {
|
||||
this.applicationArn = applicationArn;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Instant getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(Instant dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public Instant getDateUpdated() {
|
||||
return dateUpdated;
|
||||
}
|
||||
|
||||
public void setDateUpdated(Instant dateUpdated) {
|
||||
this.dateUpdated = dateUpdated;
|
||||
}
|
||||
|
||||
public List<String> getVersions() {
|
||||
return versions;
|
||||
}
|
||||
|
||||
public List<String> getConfigurationTemplates() {
|
||||
return configurationTemplates;
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package io.github.hectorvent.floci.services.elasticbeanstalk.model;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeanstalkApplicationVersion {
|
||||
|
||||
private String applicationName;
|
||||
private String versionLabel;
|
||||
private String description;
|
||||
private String sourceBundleBucket;
|
||||
private String sourceBundleKey;
|
||||
private Instant dateCreated;
|
||||
private Instant dateUpdated;
|
||||
private String status;
|
||||
private final Map<String, String> tags = new LinkedHashMap<>();
|
||||
|
||||
public String getApplicationName() {
|
||||
return applicationName;
|
||||
}
|
||||
|
||||
public void setApplicationName(String applicationName) {
|
||||
this.applicationName = applicationName;
|
||||
}
|
||||
|
||||
public String getVersionLabel() {
|
||||
return versionLabel;
|
||||
}
|
||||
|
||||
public void setVersionLabel(String versionLabel) {
|
||||
this.versionLabel = versionLabel;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getSourceBundleBucket() {
|
||||
return sourceBundleBucket;
|
||||
}
|
||||
|
||||
public void setSourceBundleBucket(String sourceBundleBucket) {
|
||||
this.sourceBundleBucket = sourceBundleBucket;
|
||||
}
|
||||
|
||||
public String getSourceBundleKey() {
|
||||
return sourceBundleKey;
|
||||
}
|
||||
|
||||
public void setSourceBundleKey(String sourceBundleKey) {
|
||||
this.sourceBundleKey = sourceBundleKey;
|
||||
}
|
||||
|
||||
public Instant getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(Instant dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public Instant getDateUpdated() {
|
||||
return dateUpdated;
|
||||
}
|
||||
|
||||
public void setDateUpdated(Instant dateUpdated) {
|
||||
this.dateUpdated = dateUpdated;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package io.github.hectorvent.floci.services.elasticbeanstalk.model;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeanstalkEnvironment {
|
||||
|
||||
private String applicationName;
|
||||
private String environmentId;
|
||||
private String environmentName;
|
||||
private String environmentArn;
|
||||
private String description;
|
||||
private String cname;
|
||||
private String endpointUrl;
|
||||
private String solutionStackName;
|
||||
private String platformArn;
|
||||
private String templateName;
|
||||
private String versionLabel;
|
||||
private String status;
|
||||
private String health;
|
||||
private String healthStatus;
|
||||
private Instant dateCreated;
|
||||
private Instant dateUpdated;
|
||||
private final List<ConfigurationOptionSetting> optionSettings = new ArrayList<>();
|
||||
private final Map<String, String> tags = new LinkedHashMap<>();
|
||||
|
||||
public String getApplicationName() {
|
||||
return applicationName;
|
||||
}
|
||||
|
||||
public void setApplicationName(String applicationName) {
|
||||
this.applicationName = applicationName;
|
||||
}
|
||||
|
||||
public String getEnvironmentId() {
|
||||
return environmentId;
|
||||
}
|
||||
|
||||
public void setEnvironmentId(String environmentId) {
|
||||
this.environmentId = environmentId;
|
||||
}
|
||||
|
||||
public String getEnvironmentName() {
|
||||
return environmentName;
|
||||
}
|
||||
|
||||
public void setEnvironmentName(String environmentName) {
|
||||
this.environmentName = environmentName;
|
||||
}
|
||||
|
||||
public String getEnvironmentArn() {
|
||||
return environmentArn;
|
||||
}
|
||||
|
||||
public void setEnvironmentArn(String environmentArn) {
|
||||
this.environmentArn = environmentArn;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCname() {
|
||||
return cname;
|
||||
}
|
||||
|
||||
public void setCname(String cname) {
|
||||
this.cname = cname;
|
||||
}
|
||||
|
||||
public String getEndpointUrl() {
|
||||
return endpointUrl;
|
||||
}
|
||||
|
||||
public void setEndpointUrl(String endpointUrl) {
|
||||
this.endpointUrl = endpointUrl;
|
||||
}
|
||||
|
||||
public String getSolutionStackName() {
|
||||
return solutionStackName;
|
||||
}
|
||||
|
||||
public void setSolutionStackName(String solutionStackName) {
|
||||
this.solutionStackName = solutionStackName;
|
||||
}
|
||||
|
||||
public String getPlatformArn() {
|
||||
return platformArn;
|
||||
}
|
||||
|
||||
public void setPlatformArn(String platformArn) {
|
||||
this.platformArn = platformArn;
|
||||
}
|
||||
|
||||
public String getTemplateName() {
|
||||
return templateName;
|
||||
}
|
||||
|
||||
public void setTemplateName(String templateName) {
|
||||
this.templateName = templateName;
|
||||
}
|
||||
|
||||
public String getVersionLabel() {
|
||||
return versionLabel;
|
||||
}
|
||||
|
||||
public void setVersionLabel(String versionLabel) {
|
||||
this.versionLabel = versionLabel;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getHealth() {
|
||||
return health;
|
||||
}
|
||||
|
||||
public void setHealth(String health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
public String getHealthStatus() {
|
||||
return healthStatus;
|
||||
}
|
||||
|
||||
public void setHealthStatus(String healthStatus) {
|
||||
this.healthStatus = healthStatus;
|
||||
}
|
||||
|
||||
public Instant getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(Instant dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public Instant getDateUpdated() {
|
||||
return dateUpdated;
|
||||
}
|
||||
|
||||
public void setDateUpdated(Instant dateUpdated) {
|
||||
this.dateUpdated = dateUpdated;
|
||||
}
|
||||
|
||||
public List<ConfigurationOptionSetting> getOptionSettings() {
|
||||
return optionSettings;
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package io.github.hectorvent.floci.services.elasticbeanstalk.model;
|
||||
|
||||
public class ConfigurationOptionSetting {
|
||||
|
||||
private String namespace;
|
||||
private String optionName;
|
||||
private String resourceName;
|
||||
private String value;
|
||||
|
||||
public ConfigurationOptionSetting() {
|
||||
}
|
||||
|
||||
public ConfigurationOptionSetting(String namespace, String optionName, String resourceName, String value) {
|
||||
this.namespace = namespace;
|
||||
this.optionName = optionName;
|
||||
this.resourceName = resourceName;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
public String getOptionName() {
|
||||
return optionName;
|
||||
}
|
||||
|
||||
public void setOptionName(String optionName) {
|
||||
this.optionName = optionName;
|
||||
}
|
||||
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user