mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(rds): report LicenseModel on DB instances (#7232)
* fix(rds): report LicenseModel on DB instances DescribeDBInstances and the Create/Modify responses now carry LicenseModel. CreateDBInstance and ModifyDBInstance store a requested LicenseModel; when none was given the engine default is reported (postgresql-license for postgres, general-public-license for mysql/mariadb, license-included for sqlserver). * test(rds): reuse RdsRequests helpers in license model test
This commit is contained in:
1 parent
1fe8eae011
commit
9a1908ff25
4 files changed
+90
-7
No files matched your search
@@ -871,7 +871,8 @@ public class RdsQueryHandler {
|
||||
includeEncryption ? null : cloudwatchLogsExportChanges(params),
|
||||
optionalInt(params.getFirst("MaxAllocatedStorage")),
|
||||
params.getFirst("StorageType"),
|
||||
params.getFirst("CACertificateIdentifier"));
|
||||
params.getFirst("CACertificateIdentifier"),
|
||||
params.getFirst("LicenseModel"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1049,7 +1050,7 @@ public class RdsQueryHandler {
|
||||
if (engine != null && engine.regionMatches(true, 0, "sqlserver", 0, 9)) {
|
||||
return "license-included";
|
||||
}
|
||||
if (engine != null && engine.equalsIgnoreCase("aurora-mysql")) {
|
||||
if (engine != null && (engine.toLowerCase().contains("mysql") || engine.equalsIgnoreCase("mariadb"))) {
|
||||
return "general-public-license";
|
||||
}
|
||||
return "postgresql-license";
|
||||
@@ -3219,6 +3220,7 @@ public class RdsQueryHandler {
|
||||
.elem("DBInstanceStatus", statusStr)
|
||||
.elem("Engine", engineStr.toLowerCase())
|
||||
.elem("EngineVersion", i.getEngineVersion())
|
||||
.elem("LicenseModel", i.getLicenseModel() != null ? i.getLicenseModel() : licenseModel(engineStr))
|
||||
.elem("MasterUsername", i.getMasterUsername());
|
||||
if (i.getDbName() != null && !i.getDbName().isBlank()) {
|
||||
xml.elem("DBName", i.getDbName());
|
||||
|
||||
@@ -28,6 +28,8 @@ public class DbInstance {
|
||||
private String storageType;
|
||||
/** The RDS certificate authority for the instance; null on one stored before it was recorded. */
|
||||
private String caCertificateIdentifier;
|
||||
/** The license model the request named; null means the engine's default. */
|
||||
private String licenseModel;
|
||||
private DbInstanceStatus status;
|
||||
private DbEndpoint endpoint;
|
||||
private boolean iamDatabaseAuthenticationEnabled;
|
||||
@@ -141,6 +143,8 @@ public class DbInstance {
|
||||
public String getStorageType() { return storageType != null ? storageType : DEFAULT_STORAGE_TYPE; }
|
||||
public void setStorageType(String storageType) { this.storageType = storageType; }
|
||||
|
||||
public String getLicenseModel() { return licenseModel; }
|
||||
public void setLicenseModel(String licenseModel) { this.licenseModel = licenseModel; }
|
||||
public String getCaCertificateIdentifier() { return caCertificateIdentifier; }
|
||||
public void setCaCertificateIdentifier(String caCertificateIdentifier) {
|
||||
this.caCertificateIdentifier = caCertificateIdentifier;
|
||||
|
||||
+23
-5
@@ -28,7 +28,22 @@ public record DbInstanceSettings(Boolean storageEncrypted,
|
||||
LogExportChanges logExportChanges,
|
||||
Integer maxAllocatedStorage,
|
||||
String storageType,
|
||||
String caCertificateIdentifier) {
|
||||
String caCertificateIdentifier,
|
||||
String licenseModel) {
|
||||
public DbInstanceSettings(Boolean storageEncrypted, String kmsKeyId, Integer backupRetentionPeriod,
|
||||
String preferredBackupWindow, String preferredMaintenanceWindow,
|
||||
Boolean copyTagsToSnapshot, Integer monitoringInterval, String monitoringRoleArn,
|
||||
Boolean performanceInsightsEnabled, Integer performanceInsightsRetentionPeriod,
|
||||
String engineLifecycleSupport, List<String> enabledCloudwatchLogsExports,
|
||||
LogExportChanges logExportChanges, Integer maxAllocatedStorage, String storageType,
|
||||
String caCertificateIdentifier) {
|
||||
this(storageEncrypted, kmsKeyId, backupRetentionPeriod, preferredBackupWindow,
|
||||
preferredMaintenanceWindow, copyTagsToSnapshot, monitoringInterval, monitoringRoleArn,
|
||||
performanceInsightsEnabled, performanceInsightsRetentionPeriod, engineLifecycleSupport,
|
||||
enabledCloudwatchLogsExports, logExportChanges, maxAllocatedStorage, storageType,
|
||||
caCertificateIdentifier, null);
|
||||
}
|
||||
|
||||
public DbInstanceSettings(Boolean storageEncrypted, String kmsKeyId, Integer backupRetentionPeriod,
|
||||
String preferredBackupWindow, String preferredMaintenanceWindow,
|
||||
Boolean copyTagsToSnapshot, Integer monitoringInterval, String monitoringRoleArn,
|
||||
@@ -201,7 +216,7 @@ public record DbInstanceSettings(Boolean storageEncrypted,
|
||||
monitoringInterval, monitoringRoleArn, performanceInsightsEnabled,
|
||||
performanceInsightsRetentionPeriod, engineLifecycleSupport,
|
||||
enabledCloudwatchLogsExports, logExportChanges, maxAllocatedStorage, storageType,
|
||||
caCertificateIdentifier);
|
||||
caCertificateIdentifier, licenseModel);
|
||||
}
|
||||
|
||||
public DbInstanceSettings withKmsKeyId(String resolvedKmsKeyId) {
|
||||
@@ -210,7 +225,7 @@ public record DbInstanceSettings(Boolean storageEncrypted,
|
||||
monitoringInterval, monitoringRoleArn, performanceInsightsEnabled,
|
||||
performanceInsightsRetentionPeriod, engineLifecycleSupport,
|
||||
enabledCloudwatchLogsExports, logExportChanges, maxAllocatedStorage, storageType,
|
||||
caCertificateIdentifier);
|
||||
caCertificateIdentifier, licenseModel);
|
||||
}
|
||||
|
||||
public DbInstanceSettings withStorageType(String resolvedStorageType) {
|
||||
@@ -219,7 +234,7 @@ public record DbInstanceSettings(Boolean storageEncrypted,
|
||||
monitoringInterval, monitoringRoleArn, performanceInsightsEnabled,
|
||||
performanceInsightsRetentionPeriod, engineLifecycleSupport,
|
||||
enabledCloudwatchLogsExports, logExportChanges, maxAllocatedStorage, resolvedStorageType,
|
||||
caCertificateIdentifier);
|
||||
caCertificateIdentifier, licenseModel);
|
||||
}
|
||||
|
||||
/** The same settings with the CA certificate the service resolved. */
|
||||
@@ -229,7 +244,7 @@ public record DbInstanceSettings(Boolean storageEncrypted,
|
||||
monitoringInterval, monitoringRoleArn, performanceInsightsEnabled,
|
||||
performanceInsightsRetentionPeriod, engineLifecycleSupport,
|
||||
enabledCloudwatchLogsExports, logExportChanges, maxAllocatedStorage, storageType,
|
||||
resolvedCaCertificateIdentifier);
|
||||
resolvedCaCertificateIdentifier, licenseModel);
|
||||
}
|
||||
|
||||
public void validateStorageType() {
|
||||
@@ -290,5 +305,8 @@ public record DbInstanceSettings(Boolean storageEncrypted,
|
||||
if (caCertificateIdentifier != null && !caCertificateIdentifier.isBlank()) {
|
||||
instance.setCaCertificateIdentifier(caCertificateIdentifier);
|
||||
}
|
||||
if (licenseModel != null && !licenseModel.isBlank()) {
|
||||
instance.setLicenseModel(licenseModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user