mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 09:22:49 -05:00
feat(rds): IAM role associations for DB clusters and instances (#5367)
* feat(rds): IAM role associations for DB clusters and instances AddRoleToDBCluster, RemoveRoleFromDBCluster, AddRoleToDBInstance and RemoveRoleFromDBInstance answered UnsupportedOperation, and DBCluster and DBInstance carried no AssociatedRoles, so Terraform's aws_rds_cluster_role_association and aws_db_instance_role_association could not apply. Clusters and instances now keep their associated roles and report them as AssociatedRoles, ACTIVE as soon as they are added. The four actions raise the faults the API model lists, and CreateDBCluster accepts AssociatedRoles, checked before the cluster is created. Feature names are not yet validated against the engine. Closes #5343 * fix(rds): route the instance role actions, and refuse only a repeated cluster role AddRoleToDBInstance and RemoveRoleFromDBInstance were missing from RDS_ACTIONS, so a request with no credential scope reached SQS. DBClusterRoleAlreadyExists covers the role ARN only, so a cluster now takes a second role for a feature that already has one. Instances keep refusing a repeated role or feature, as their fault documents. CreateDBCluster reads every AssociatedRoles index, gaps included, and refuses an entry without a RoleArn. It associates the roles in one step and deletes the new cluster if that is refused. * refactor(rds): import the types parseAssociatedRoles uses The regex and sorted-set types were written with their packages inline; AGENTS.md asks for imports. The role association compat test gains a DisplayName like the others in its class. * docs(rds): count the role association actions alongside the catalogue reads #5196 and this branch each added four RDS actions, so the service matrix count is 98.
This commit is contained in:
1 parent
a017c94ecc
commit
5e48cbb80b
12 files changed
+731
-2
No files matched your search
@@ -560,7 +560,7 @@ public class AwsQueryController {
|
||||
"CreateDBSubnetGroup", "DescribeDBSubnetGroups", "ModifyDBSubnetGroup", "DeleteDBSubnetGroup",
|
||||
"AddTagsToResource", "ListTagsForResource", "RemoveTagsFromResource",
|
||||
"CreateDBCluster", "DescribeDBClusters", "DeleteDBCluster", "ModifyDBCluster",
|
||||
"AddRoleToDBCluster", "RemoveRoleFromDBCluster",
|
||||
"AddRoleToDBCluster", "RemoveRoleFromDBCluster", "AddRoleToDBInstance", "RemoveRoleFromDBInstance",
|
||||
"DescribeGlobalClusters",
|
||||
"CreateDBParameterGroup", "DescribeDBParameterGroups",
|
||||
"DeleteDBParameterGroup", "ModifyDBParameterGroup", "DescribeDBParameters",
|
||||
|
||||
@@ -23,6 +23,7 @@ import io.github.hectorvent.floci.services.rds.model.DbProxy;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbProxyAuth;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbProxyTarget;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbProxyTargetGroup;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbRoleAssociation;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbSnapshot;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbSubnetGroup;
|
||||
import io.github.hectorvent.floci.services.rds.model.EventSubscription;
|
||||
@@ -46,7 +47,11 @@ import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Query-protocol handler for all RDS actions (form-encoded POST, XML response).
|
||||
@@ -108,6 +113,10 @@ public class RdsQueryHandler {
|
||||
case "DescribeDBClusterEndpoints" -> handleDescribeDbClusterEndpoints(params, region);
|
||||
case "ModifyDBClusterEndpoint" -> handleModifyDbClusterEndpoint(params, region);
|
||||
case "DeleteDBClusterEndpoint" -> handleDeleteDbClusterEndpoint(params, region);
|
||||
case "AddRoleToDBCluster" -> handleAddRoleToDbCluster(params, region);
|
||||
case "RemoveRoleFromDBCluster" -> handleRemoveRoleFromDbCluster(params, region);
|
||||
case "AddRoleToDBInstance" -> handleAddRoleToDbInstance(params, region);
|
||||
case "RemoveRoleFromDBInstance" -> handleRemoveRoleFromDbInstance(params, region);
|
||||
case "AddSourceIdentifierToSubscription" ->
|
||||
handleAddSourceIdentifierToSubscription(params, region);
|
||||
case "RemoveSourceIdentifierFromSubscription" ->
|
||||
@@ -359,6 +368,57 @@ public class RdsQueryHandler {
|
||||
new XmlBuilder().raw(eventSubscriptionXml(subscription)).build())).build();
|
||||
}
|
||||
|
||||
private Response handleAddRoleToDbCluster(MultivaluedMap<String, String> params, String region) {
|
||||
service.addRoleToDbCluster(region, params.getFirst("DBClusterIdentifier"),
|
||||
params.getFirst("RoleArn"), params.getFirst("FeatureName"));
|
||||
return Response.ok(AwsQueryResponse.envelopeNoResult("AddRoleToDBCluster", AwsNamespaces.RDS)).build();
|
||||
}
|
||||
|
||||
private Response handleRemoveRoleFromDbCluster(MultivaluedMap<String, String> params, String region) {
|
||||
service.removeRoleFromDbCluster(region, params.getFirst("DBClusterIdentifier"),
|
||||
params.getFirst("RoleArn"), params.getFirst("FeatureName"));
|
||||
return Response.ok(AwsQueryResponse.envelopeNoResult("RemoveRoleFromDBCluster", AwsNamespaces.RDS)).build();
|
||||
}
|
||||
|
||||
private Response handleAddRoleToDbInstance(MultivaluedMap<String, String> params, String region) {
|
||||
service.addRoleToDbInstance(region, params.getFirst("DBInstanceIdentifier"),
|
||||
params.getFirst("RoleArn"), params.getFirst("FeatureName"));
|
||||
return Response.ok(AwsQueryResponse.envelopeNoResult("AddRoleToDBInstance", AwsNamespaces.RDS)).build();
|
||||
}
|
||||
|
||||
private Response handleRemoveRoleFromDbInstance(MultivaluedMap<String, String> params, String region) {
|
||||
service.removeRoleFromDbInstance(region, params.getFirst("DBInstanceIdentifier"),
|
||||
params.getFirst("RoleArn"), params.getFirst("FeatureName"));
|
||||
return Response.ok(AwsQueryResponse.envelopeNoResult("RemoveRoleFromDBInstance", AwsNamespaces.RDS)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@code AssociatedRoles} a {@code CreateDBCluster} request names. botocore and the Java SDK
|
||||
* send the model's member name ({@code AssociatedRoles.DBClusterAssociatedRole.N.RoleArn});
|
||||
* {@code .member.N} is read too, as the other RDS lists accept it.
|
||||
*/
|
||||
private static List<DbRoleAssociation> parseAssociatedRoles(MultivaluedMap<String, String> params) {
|
||||
List<DbRoleAssociation> roles = new ArrayList<>();
|
||||
for (String prefix : List.of("AssociatedRoles.DBClusterAssociatedRole", "AssociatedRoles.member")) {
|
||||
// Every index the request names, in order, whichever field it carries: an entry with a
|
||||
// FeatureName and no RoleArn reaches validation and is refused there, and a gap in the
|
||||
// numbering does not hide the entries after it.
|
||||
Pattern field = Pattern.compile(Pattern.quote(prefix) + "\\.(\\d+)\\.(RoleArn|FeatureName)");
|
||||
SortedSet<Integer> indexes = new TreeSet<>();
|
||||
for (String key : params.keySet()) {
|
||||
Matcher matcher = field.matcher(key);
|
||||
if (matcher.matches()) {
|
||||
indexes.add(Integer.parseInt(matcher.group(1)));
|
||||
}
|
||||
}
|
||||
for (int i : indexes) {
|
||||
roles.add(new DbRoleAssociation(params.getFirst(prefix + "." + i + ".RoleArn"),
|
||||
params.getFirst(prefix + "." + i + ".FeatureName")));
|
||||
}
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
private Response handleCreateDbClusterEndpoint(MultivaluedMap<String, String> params, String region) {
|
||||
DbClusterEndpoint endpoint = service.createDbClusterEndpoint(region,
|
||||
params.getFirst("DBClusterIdentifier"),
|
||||
@@ -1115,6 +1175,8 @@ public class RdsQueryHandler {
|
||||
}
|
||||
|
||||
try {
|
||||
List<DbRoleAssociation> associatedRoles = parseAssociatedRoles(params);
|
||||
service.validateClusterRoleAssociations(id, associatedRoles);
|
||||
Double serverlessV2Min = parseDoubleParam(params, "ServerlessV2ScalingConfiguration.MinCapacity");
|
||||
Double serverlessV2Max = parseDoubleParam(params, "ServerlessV2ScalingConfiguration.MaxCapacity");
|
||||
Integer serverlessV2SecondsUntilAutoPause = parseIntegerParam(
|
||||
@@ -1149,6 +1211,14 @@ public class RdsQueryHandler {
|
||||
manageMasterUserPassword, masterUserSecretKmsKeyId, engineMode, storageEncrypted,
|
||||
requestedPort);
|
||||
}
|
||||
if (!associatedRoles.isEmpty()) {
|
||||
try {
|
||||
cluster = service.addRolesToNewDbCluster(region, id, associatedRoles);
|
||||
} catch (AwsException e) {
|
||||
service.deleteDbCluster(id, region);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
String result = dbClusterXml(cluster);
|
||||
return Response.ok(AwsQueryResponse.envelope("CreateDBCluster", AwsNamespaces.RDS, result)).build();
|
||||
} catch (AwsException e) {
|
||||
@@ -2685,6 +2755,7 @@ public class RdsQueryHandler {
|
||||
xml.elem("DBClusterIdentifier", i.getDbClusterIdentifier());
|
||||
}
|
||||
xml.raw(readReplicaXml(i));
|
||||
writeAssociatedRoles(xml, i.getAssociatedRoles(), "DBInstanceRole");
|
||||
xml.start("TagList");
|
||||
writeTags(xml, i.getTags());
|
||||
xml.end("TagList");
|
||||
@@ -2894,9 +2965,23 @@ public class RdsQueryHandler {
|
||||
}
|
||||
}
|
||||
xml.end("DBClusterMembers");
|
||||
writeAssociatedRoles(xml, c.getAssociatedRoles(), "DBClusterRole");
|
||||
return xml.build();
|
||||
}
|
||||
|
||||
/** {@code AssociatedRoles}, each entry named as the model names it for the resource. */
|
||||
private static void writeAssociatedRoles(XmlBuilder xml, List<DbRoleAssociation> roles, String elementName) {
|
||||
xml.start("AssociatedRoles");
|
||||
for (DbRoleAssociation role : roles) {
|
||||
xml.start(elementName).elem("RoleArn", role.getRoleArn());
|
||||
if (role.getFeatureName() != null) {
|
||||
xml.elem("FeatureName", role.getFeatureName());
|
||||
}
|
||||
xml.elem("Status", role.getStatus()).end(elementName);
|
||||
}
|
||||
xml.end("AssociatedRoles");
|
||||
}
|
||||
|
||||
private String paramGroupXml(DbParameterGroup g) {
|
||||
return new XmlBuilder().start("DBParameterGroup").raw(paramGroupInnerXml(g)).end("DBParameterGroup").build();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import io.github.hectorvent.floci.services.rds.model.DbProxy;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbProxyAuth;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbProxyTarget;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbProxyTargetGroup;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbRoleAssociation;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbSnapshot;
|
||||
import io.github.hectorvent.floci.services.rds.model.DbSubnetGroup;
|
||||
import io.github.hectorvent.floci.services.rds.model.EventSubscription;
|
||||
@@ -75,6 +76,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -9556,6 +9558,166 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
return subscription;
|
||||
}
|
||||
|
||||
// ── IAM role associations ─────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Associates an IAM role with a DB cluster. A cluster names each role once, so the same role
|
||||
* twice is refused ({@code DBClusterRoleAlreadyExists} covers the role ARN only). The role is
|
||||
* {@code ACTIVE} at once and is not looked up in IAM.
|
||||
*/
|
||||
public synchronized DbCluster addRoleToDbCluster(String region, String clusterId, String roleArn,
|
||||
String featureName) {
|
||||
requireParameter(clusterId, "DBClusterIdentifier");
|
||||
requireParameter(roleArn, "RoleArn");
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
DbCluster cluster = getDbCluster(clusterId, effectiveRegion);
|
||||
requireAvailableCluster(cluster, clusterId);
|
||||
requireRoleNotAssociated(cluster, clusterId, roleArn);
|
||||
cluster.getAssociatedRoles().add(new DbRoleAssociation(roleArn, blankToNull(featureName)));
|
||||
putClusterForScope(currentAccountId(), effectiveRegion, clusterId, cluster);
|
||||
LOG.infov("Role {0} associated with DB cluster {1}", roleArn, clusterId);
|
||||
return RESPONSE_COPIER.convertValue(cluster, DbCluster.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives a cluster {@code CreateDBCluster} just made the roles the request named, all in one
|
||||
* step: either every role is associated or none is. The handler deletes the new cluster when
|
||||
* this refuses, so a failed create leaves nothing behind.
|
||||
*/
|
||||
public synchronized DbCluster addRolesToNewDbCluster(String region, String clusterId,
|
||||
List<DbRoleAssociation> roles) {
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
DbCluster cluster = getDbCluster(clusterId, effectiveRegion);
|
||||
requireAvailableCluster(cluster, clusterId);
|
||||
for (DbRoleAssociation role : roles) {
|
||||
requireRoleNotAssociated(cluster, clusterId, role.getRoleArn());
|
||||
}
|
||||
for (DbRoleAssociation role : roles) {
|
||||
cluster.getAssociatedRoles().add(new DbRoleAssociation(role.getRoleArn(),
|
||||
blankToNull(role.getFeatureName())));
|
||||
}
|
||||
putClusterForScope(currentAccountId(), effectiveRegion, clusterId, cluster);
|
||||
return RESPONSE_COPIER.convertValue(cluster, DbCluster.class);
|
||||
}
|
||||
|
||||
private static void requireRoleNotAssociated(DbCluster cluster, String clusterId, String roleArn) {
|
||||
for (DbRoleAssociation existing : cluster.getAssociatedRoles()) {
|
||||
if (existing.getRoleArn().equals(roleArn)) {
|
||||
throw new AwsException("DBClusterRoleAlreadyExists", "Role ARN " + roleArn
|
||||
+ " is already associated with DB cluster " + clusterId + ".", 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a role from a DB cluster. When a feature name is given, the role must be associated
|
||||
* for that feature.
|
||||
*/
|
||||
public synchronized DbCluster removeRoleFromDbCluster(String region, String clusterId, String roleArn,
|
||||
String featureName) {
|
||||
requireParameter(clusterId, "DBClusterIdentifier");
|
||||
requireParameter(roleArn, "RoleArn");
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
DbCluster cluster = getDbCluster(clusterId, effectiveRegion);
|
||||
requireAvailableCluster(cluster, clusterId);
|
||||
String feature = blankToNull(featureName);
|
||||
boolean removed = cluster.getAssociatedRoles().removeIf(existing -> existing.getRoleArn().equals(roleArn)
|
||||
&& (feature == null || feature.equals(existing.getFeatureName())));
|
||||
if (!removed) {
|
||||
throw new AwsException("DBClusterRoleNotFound", "Role ARN " + roleArn
|
||||
+ (feature == null ? "" : " for feature " + feature)
|
||||
+ " is not associated with DB cluster " + clusterId + ".", 404);
|
||||
}
|
||||
putClusterForScope(currentAccountId(), effectiveRegion, clusterId, cluster);
|
||||
LOG.infov("Role {0} disassociated from DB cluster {1}", roleArn, clusterId);
|
||||
return RESPONSE_COPIER.convertValue(cluster, DbCluster.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Associates an IAM role with a DB instance for one feature. The role and the feature are each
|
||||
* associated at most once, so either one already present is refused.
|
||||
*/
|
||||
public synchronized DbInstance addRoleToDbInstance(String region, String instanceId, String roleArn,
|
||||
String featureName) {
|
||||
requireParameter(instanceId, "DBInstanceIdentifier");
|
||||
requireParameter(roleArn, "RoleArn");
|
||||
requireParameter(featureName, "FeatureName");
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
DbInstance instance = getDbInstance(instanceId, effectiveRegion);
|
||||
requireAvailableInstance(instance, instanceId);
|
||||
for (DbRoleAssociation existing : instance.getAssociatedRoles()) {
|
||||
if (existing.getRoleArn().equals(roleArn) || featureName.equals(existing.getFeatureName())) {
|
||||
throw new AwsException("DBInstanceRoleAlreadyExists", "Role ARN " + existing.getRoleArn()
|
||||
+ " is already associated with DB instance " + instanceId + " for feature "
|
||||
+ existing.getFeatureName() + ".", 400);
|
||||
}
|
||||
}
|
||||
instance.getAssociatedRoles().add(new DbRoleAssociation(roleArn, featureName));
|
||||
putInstanceForScope(currentAccountId(), effectiveRegion, instanceId, instance);
|
||||
LOG.infov("Role {0} associated with DB instance {1} for feature {2}", roleArn, instanceId, featureName);
|
||||
return RESPONSE_COPIER.convertValue(instance, DbInstance.class);
|
||||
}
|
||||
|
||||
/** Removes a role from a DB instance; the role must be associated for the feature named. */
|
||||
public synchronized DbInstance removeRoleFromDbInstance(String region, String instanceId, String roleArn,
|
||||
String featureName) {
|
||||
requireParameter(instanceId, "DBInstanceIdentifier");
|
||||
requireParameter(roleArn, "RoleArn");
|
||||
requireParameter(featureName, "FeatureName");
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
DbInstance instance = getDbInstance(instanceId, effectiveRegion);
|
||||
requireAvailableInstance(instance, instanceId);
|
||||
boolean removed = instance.getAssociatedRoles().removeIf(existing -> existing.getRoleArn().equals(roleArn)
|
||||
&& featureName.equals(existing.getFeatureName()));
|
||||
if (!removed) {
|
||||
throw new AwsException("DBInstanceRoleNotFound", "Role ARN " + roleArn
|
||||
+ " is not associated with DB instance " + instanceId + " for feature " + featureName + ".", 404);
|
||||
}
|
||||
putInstanceForScope(currentAccountId(), effectiveRegion, instanceId, instance);
|
||||
LOG.infov("Role {0} disassociated from DB instance {1}", roleArn, instanceId);
|
||||
return RESPONSE_COPIER.convertValue(instance, DbInstance.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the roles a {@code CreateDBCluster} request names before the cluster exists, by the
|
||||
* rules {@link #addRoleToDbCluster} applies one at a time, so a list that would be refused part
|
||||
* way through refuses the create instead of leaving a cluster with half its roles.
|
||||
*/
|
||||
public void validateClusterRoleAssociations(String clusterId, List<DbRoleAssociation> roles) {
|
||||
Set<String> roleArns = new HashSet<>();
|
||||
for (DbRoleAssociation role : roles) {
|
||||
requireParameter(role.getRoleArn(), "AssociatedRoles.RoleArn");
|
||||
if (!roleArns.add(role.getRoleArn())) {
|
||||
throw new AwsException("DBClusterRoleAlreadyExists", "Role ARN " + role.getRoleArn()
|
||||
+ " is named more than once for DB cluster " + clusterId + ".", 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String blankToNull(String value) {
|
||||
return isBlank(value) ? null : value;
|
||||
}
|
||||
|
||||
private static void requireParameter(String value, String name) {
|
||||
if (isBlank(value)) {
|
||||
throw new AwsException("MissingParameter", "The request must contain the parameter " + name + ".", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private static void requireAvailableCluster(DbCluster cluster, String clusterId) {
|
||||
if (cluster.getStatus() != null && cluster.getStatus() != DbInstanceStatus.AVAILABLE) {
|
||||
throw new AwsException("InvalidDBClusterStateFault",
|
||||
"DB cluster " + clusterId + " is not in available state.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private static void requireAvailableInstance(DbInstance instance, String instanceId) {
|
||||
if (instance.getStatus() != null && instance.getStatus() != DbInstanceStatus.AVAILABLE) {
|
||||
throw new AwsException("InvalidDBInstanceState",
|
||||
"DB instance " + instanceId + " is not in available state.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Cluster endpoints ─────────────────────────────────────────────────────
|
||||
|
||||
private static final int MAX_CUSTOM_ENDPOINTS_PER_CLUSTER = 5;
|
||||
|
||||
@@ -42,6 +42,7 @@ public class DbCluster {
|
||||
private Instant createdAt;
|
||||
private int proxyPort;
|
||||
private Map<String, String> tags = new LinkedHashMap<>();
|
||||
private List<DbRoleAssociation> associatedRoles = new ArrayList<>();
|
||||
private String engineMode;
|
||||
private boolean storageEncrypted;
|
||||
|
||||
@@ -179,6 +180,11 @@ public class DbCluster {
|
||||
public int getProxyPort() { return proxyPort; }
|
||||
public void setProxyPort(int proxyPort) { this.proxyPort = proxyPort; }
|
||||
|
||||
public List<DbRoleAssociation> getAssociatedRoles() { return associatedRoles; }
|
||||
public void setAssociatedRoles(List<DbRoleAssociation> associatedRoles) {
|
||||
this.associatedRoles = associatedRoles != null ? new ArrayList<>(associatedRoles) : new ArrayList<>();
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() { return tags; }
|
||||
public void setTags(Map<String, String> tags) { this.tags = tags != null ? new LinkedHashMap<>(tags) : new LinkedHashMap<>(); }
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ public class DbInstance {
|
||||
private String masterUserSecretStatus;
|
||||
private String masterUserSecretKmsKeyId;
|
||||
private Map<String, String> tags = new LinkedHashMap<>();
|
||||
private List<DbRoleAssociation> associatedRoles = new ArrayList<>();
|
||||
private Instant createdAt;
|
||||
private int proxyPort;
|
||||
// Read replication links, kept on both ends the way DescribeDBInstances reports them: a
|
||||
@@ -246,6 +247,11 @@ public class DbInstance {
|
||||
&& !readReplicaSourceDbInstanceIdentifier.isBlank();
|
||||
}
|
||||
|
||||
public List<DbRoleAssociation> getAssociatedRoles() { return associatedRoles; }
|
||||
public void setAssociatedRoles(List<DbRoleAssociation> associatedRoles) {
|
||||
this.associatedRoles = associatedRoles != null ? new ArrayList<>(associatedRoles) : new ArrayList<>();
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() { return tags; }
|
||||
public void setTags(Map<String, String> tags) { this.tags = tags != null ? new LinkedHashMap<>(tags) : new LinkedHashMap<>(); }
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.github.hectorvent.floci.services.rds.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
/**
|
||||
* An IAM role associated with a DB cluster or DB instance, reported as a {@code DBClusterRole} or
|
||||
* {@code DBInstanceRole} in {@code AssociatedRoles}. The feature name is optional for a cluster
|
||||
* and required for an instance. The status is {@code ACTIVE} from the moment the role is added.
|
||||
*/
|
||||
@RegisterForReflection
|
||||
public class DbRoleAssociation {
|
||||
|
||||
public static final String ACTIVE = "ACTIVE";
|
||||
|
||||
private String roleArn;
|
||||
private String featureName;
|
||||
private String status;
|
||||
|
||||
public DbRoleAssociation() {}
|
||||
|
||||
public DbRoleAssociation(String roleArn, String featureName) {
|
||||
this.roleArn = roleArn;
|
||||
this.featureName = featureName;
|
||||
this.status = ACTIVE;
|
||||
}
|
||||
|
||||
public String getRoleArn() { return roleArn; }
|
||||
public void setRoleArn(String roleArn) { this.roleArn = roleArn; }
|
||||
|
||||
public String getFeatureName() { return featureName; }
|
||||
public void setFeatureName(String featureName) { this.featureName = featureName; }
|
||||
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
}
|
||||
Reference in new issue
Block a user