mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(elasticache): keep requested EngineVersion and AutoMinorVersionUpgrade (#7177)
This commit is contained in:
1 parent
38eb938f22
commit
a712e5123b
6 files changed
+84
-5
No files matched your search
+4
-1
@@ -144,10 +144,13 @@ public class ElastiCacheMemcachedService {
|
||||
Endpoint endpoint = new Endpoint(endpointHost, endpointPort);
|
||||
|
||||
CacheCluster cluster = new CacheCluster(
|
||||
clusterId, CacheClusterStatus.AVAILABLE, ENGINE, ENGINE_VERSION,
|
||||
clusterId, CacheClusterStatus.AVAILABLE, ENGINE,
|
||||
request.engineVersion() != null && !request.engineVersion().isBlank()
|
||||
? request.engineVersion() : ENGINE_VERSION,
|
||||
endpoint, Instant.now());
|
||||
// What terraform's aws_elasticache_cluster reads back: anything the request set and the
|
||||
// describe omitted would be a diff no apply can settle.
|
||||
cluster.setAutoMinorVersionUpgrade(request.autoMinorVersionUpgrade());
|
||||
cluster.setNumCacheNodes(request.numCacheNodes() != null ? request.numCacheNodes() : 1);
|
||||
cluster.setCacheNodeType(request.cacheNodeType() != null && !request.cacheNodeType().isBlank()
|
||||
? request.cacheNodeType() : DEFAULT_CACHE_NODE_TYPE);
|
||||
|
||||
+4
-3
@@ -454,7 +454,8 @@ public class ElastiCacheQueryHandler {
|
||||
params.getFirst("IpDiscovery"),
|
||||
boolParam(params, "AtRestEncryptionEnabled"),
|
||||
region,
|
||||
parseTags(params));
|
||||
parseTags(params),
|
||||
boolParam(params, "AutoMinorVersionUpgrade"));
|
||||
CacheCluster cluster = "memcached".equalsIgnoreCase(engine)
|
||||
? memcachedService.createCacheCluster(request)
|
||||
: service.createCacheCluster(request);
|
||||
@@ -1039,7 +1040,8 @@ private Response handleCreateCacheParameterGroup(MultivaluedMap<String, String>
|
||||
.elem("CacheClusterId", c.getCacheClusterId())
|
||||
.elem("CacheClusterStatus", c.getCacheClusterStatus().wireName())
|
||||
.elem("Engine", c.getEngine())
|
||||
.elem("EngineVersion", c.getEngineVersion());
|
||||
.elem("EngineVersion", c.getEngineVersion())
|
||||
.elem("AutoMinorVersionUpgrade", c.isAutoMinorVersionUpgrade());
|
||||
boolean memcached = "memcached".equals(c.getEngine());
|
||||
int numCacheNodes = c.getNumCacheNodes();
|
||||
if (memcached) {
|
||||
@@ -1055,7 +1057,6 @@ private Response handleCreateCacheParameterGroup(MultivaluedMap<String, String>
|
||||
xml.elem("NumCacheNodes", (long) numCacheNodes);
|
||||
} else {
|
||||
xml.elem("NumCacheNodes", (long) numCacheNodes)
|
||||
.elem("AutoMinorVersionUpgrade", true)
|
||||
.elem("AuthTokenEnabled", c.getAuthMode() == AuthMode.PASSWORD)
|
||||
.elem("TransitEncryptionEnabled", c.getAuthMode() != null && c.getAuthMode() != AuthMode.NO_AUTH)
|
||||
.elem("AtRestEncryptionEnabled", c.isAtRestEncryptionEnabled())
|
||||
|
||||
+15
-1
@@ -1271,7 +1271,20 @@ public class ElastiCacheService implements ResourceProvider {
|
||||
String ipDiscovery,
|
||||
Boolean atRestEncryptionEnabled,
|
||||
String region,
|
||||
Map<String, String> tags) {
|
||||
Map<String, String> tags,
|
||||
Boolean autoMinorVersionUpgrade) {
|
||||
public CreateCacheClusterRequest(String cacheClusterId, String engine, String engineVersion,
|
||||
String cacheNodeType, Integer numCacheNodes, Integer port, AuthMode authMode,
|
||||
String authToken, String cacheParameterGroupName, String cacheSubnetGroupName,
|
||||
Integer snapshotRetentionLimit, String snapshotWindow, String preferredMaintenanceWindow,
|
||||
String preferredAvailabilityZone, List<String> securityGroupIds, String networkType,
|
||||
String ipDiscovery, Boolean atRestEncryptionEnabled, String region,
|
||||
Map<String, String> tags) {
|
||||
this(cacheClusterId, engine, engineVersion, cacheNodeType, numCacheNodes, port, authMode,
|
||||
authToken, cacheParameterGroupName, cacheSubnetGroupName, snapshotRetentionLimit,
|
||||
snapshotWindow, preferredMaintenanceWindow, preferredAvailabilityZone, securityGroupIds,
|
||||
networkType, ipDiscovery, atRestEncryptionEnabled, region, tags, null);
|
||||
}
|
||||
}
|
||||
|
||||
public CacheCluster createCacheCluster(CreateCacheClusterRequest request) {
|
||||
@@ -1501,6 +1514,7 @@ public class ElastiCacheService implements ResourceProvider {
|
||||
cluster.setIpDiscovery(request.ipDiscovery() != null && !request.ipDiscovery().isBlank()
|
||||
? request.ipDiscovery() : "ipv4");
|
||||
cluster.setAtRestEncryptionEnabled(Boolean.TRUE.equals(request.atRestEncryptionEnabled()));
|
||||
cluster.setAutoMinorVersionUpgrade(request.autoMinorVersionUpgrade());
|
||||
if (request.securityGroupIds() != null && !request.securityGroupIds().isEmpty()) {
|
||||
cluster.setSecurityGroupIds(new ArrayList<>(request.securityGroupIds()));
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ public class CacheCluster {
|
||||
private CacheClusterStatus cacheClusterStatus;
|
||||
private String engine;
|
||||
private String engineVersion;
|
||||
// null on records persisted before the field existed; AWS defaults it to true
|
||||
private Boolean autoMinorVersionUpgrade;
|
||||
private Endpoint configurationEndpoint;
|
||||
private Instant cacheClusterCreateTime;
|
||||
private String cacheNodeType;
|
||||
@@ -69,6 +71,9 @@ public class CacheCluster {
|
||||
public String getEngineVersion() { return engineVersion; }
|
||||
public void setEngineVersion(String engineVersion) { this.engineVersion = engineVersion; }
|
||||
|
||||
public boolean isAutoMinorVersionUpgrade() { return autoMinorVersionUpgrade == null || autoMinorVersionUpgrade; }
|
||||
public void setAutoMinorVersionUpgrade(Boolean autoMinorVersionUpgrade) { this.autoMinorVersionUpgrade = autoMinorVersionUpgrade; }
|
||||
|
||||
public Endpoint getConfigurationEndpoint() { return configurationEndpoint; }
|
||||
public void setConfigurationEndpoint(Endpoint configurationEndpoint) { this.configurationEndpoint = configurationEndpoint; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user