-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DR-3128] Convert config classes to records (#1487)
* Change DuosConfiguration to record * Change EcmConfiguration to record * Change OauthConfiguration to record * Change PolicyServiceConfiguration to record * Change RawlsConfiguration to record * Change ResourceBufferServiceConfiguration to record * Change SamConfiguration to record * Change SentryConfiguration to record * Change TerraConfiguration to record * Change UserMetricsConfiguration to record * Spotbugs fixes * Fix annotations * Add ConstructorBinding annotation * Change MigrateConfiguration to record * Convert BigQueryConfiguration to record * Convert GcsConfiguration to record * Convert AzureResourceConfiguration to record * Change GoogleResourceConfiguration to record * Fix SamConfiguration comment * Update src/main/java/bio/terra/app/configuration/PolicyServiceConfiguration.java Co-authored-by: Phil Shapiro <[email protected]> * Fix AzureResourceConfiguration --------- Co-authored-by: Phil Shapiro <[email protected]>
- Loading branch information
1 parent
66c278f
commit 3198570
Showing
70 changed files
with
265 additions
and
790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 3 additions & 14 deletions
17
src/main/java/bio/terra/app/configuration/DuosConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
package bio.terra.app.configuration; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
@Configuration | ||
@ConfigurationProperties(prefix = "duos") | ||
public class DuosConfiguration { | ||
|
||
private String basePath; | ||
|
||
public String getBasePath() { | ||
return basePath; | ||
} | ||
|
||
public void setBasePath(String basePath) { | ||
this.basePath = basePath; | ||
} | ||
} | ||
@ConstructorBinding | ||
public record DuosConfiguration(String basePath) {} |
28 changes: 3 additions & 25 deletions
28
src/main/java/bio/terra/app/configuration/EcmConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,8 @@ | ||
package bio.terra.app.configuration; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties | ||
@ConfigurationProperties(prefix = "ecm") | ||
public class EcmConfiguration { | ||
|
||
private String basePath; | ||
private String rasIssuer; | ||
|
||
public String getBasePath() { | ||
return basePath; | ||
} | ||
|
||
public void setBasePath(String basePath) { | ||
this.basePath = basePath; | ||
} | ||
|
||
public String getRasIssuer() { | ||
return rasIssuer; | ||
} | ||
|
||
public void setRasIssuer(String rasIssuer) { | ||
this.rasIssuer = rasIssuer; | ||
} | ||
} | ||
@ConstructorBinding | ||
public record EcmConfiguration(String basePath, String rasIssuer) {} |
47 changes: 4 additions & 43 deletions
47
src/main/java/bio/terra/app/configuration/OauthConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,9 @@ | ||
package bio.terra.app.configuration; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties | ||
@ConfigurationProperties(prefix = "oauth") | ||
public class OauthConfiguration { | ||
|
||
private String schemeName; | ||
private String loginEndpoint; | ||
private String clientId; | ||
private String clientSecret; | ||
|
||
public String getSchemeName() { | ||
return schemeName; | ||
} | ||
|
||
public void setSchemeName(String schemeName) { | ||
this.schemeName = schemeName; | ||
} | ||
|
||
public String getLoginEndpoint() { | ||
return loginEndpoint; | ||
} | ||
|
||
public void setLoginEndpoint(String loginEndpoint) { | ||
this.loginEndpoint = loginEndpoint; | ||
} | ||
|
||
public String getClientId() { | ||
return clientId; | ||
} | ||
|
||
public void setClientId(String clientId) { | ||
this.clientId = clientId; | ||
} | ||
|
||
public String getClientSecret() { | ||
return clientSecret; | ||
} | ||
|
||
public void setClientSecret(String clientSecret) { | ||
this.clientSecret = clientSecret; | ||
} | ||
} | ||
@ConstructorBinding | ||
public record OauthConfiguration( | ||
String schemeName, String loginEndpoint, String clientId, String clientSecret) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 3 additions & 16 deletions
19
src/main/java/bio/terra/app/configuration/RawlsConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
package bio.terra.app.configuration; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties | ||
@ConfigurationProperties(prefix = "rawls") | ||
public class RawlsConfiguration { | ||
|
||
private String basePath; | ||
|
||
public String getBasePath() { | ||
return basePath; | ||
} | ||
|
||
public void setBasePath(String basePath) { | ||
this.basePath = basePath; | ||
} | ||
} | ||
@ConstructorBinding | ||
public record RawlsConfiguration(String basePath) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 22 additions & 77 deletions
99
src/main/java/bio/terra/app/configuration/SamConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,26 @@ | ||
package bio.terra.app.configuration; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
/* | ||
* SAM Retry notes: | ||
* We frequently experience socket timeouts with SAM, so we have implemented retry. The | ||
* configuration controls work like this. operationTimeoutSeconds is the maximum amount of time we | ||
* allow for the SAM operation, including the SAM operations and our retry sleep time. This is the | ||
* upper bound on how long the entire operation will take. | ||
* | ||
* The retry strategy is exponential backoff. The error wait starts at retryInitialWaitSeconds, | ||
* and doubles up to retryMaximumWaitSeconds. The retry stays at retryMaximumWaitSeconds until we | ||
* reach the operationTimeoutSeconds limit. Well, depending on the numbers you choose, we might hit | ||
* operationTimeoutSeconds before we reach retryMaximumSeconds. | ||
*/ | ||
@ConfigurationProperties(prefix = "sam") | ||
public class SamConfiguration { | ||
private String basePath; | ||
private String stewardsGroupEmail; | ||
private String adminsGroupEmail; | ||
private int retryInitialWaitSeconds; | ||
private int retryMaximumWaitSeconds; | ||
private int operationTimeoutSeconds; | ||
|
||
public String getBasePath() { | ||
return basePath; | ||
} | ||
|
||
public void setBasePath(String basePath) { | ||
this.basePath = basePath; | ||
} | ||
|
||
public String getStewardsGroupEmail() { | ||
return stewardsGroupEmail; | ||
} | ||
|
||
public void setStewardsGroupEmail(String stewardsGroupEmail) { | ||
this.stewardsGroupEmail = stewardsGroupEmail; | ||
} | ||
|
||
public String getAdminsGroupEmail() { | ||
return adminsGroupEmail; | ||
} | ||
|
||
public void setAdminsGroupEmail(String adminsGroupEmail) { | ||
this.adminsGroupEmail = adminsGroupEmail; | ||
} | ||
|
||
// SAM Retry notes: | ||
// We frequently experience socket timeouts with SAM, so we have implemented retry. The | ||
// configuration controls | ||
// work like this. operationTimeoutSeconds is the maximum amount of time we allow for the SAM | ||
// operation, | ||
// including the SAM operations and our retry sleep time. This is the upper bound on how long the | ||
// entire | ||
// operation will take. | ||
// | ||
// The retry strategy is exponential backoff. The error wait starts at retryInitialWaitSeconds, | ||
// and doubles | ||
// up to retryMaximumWaitSeconds. The retry stays at retryMaximumWaitSeconds until we reach the | ||
// operationTimeoutSeconds limit. Well, depending on the numbers you choose, we might hit | ||
// operationTimeoutSeconds | ||
// before we reach retryMaximumSeconds. | ||
|
||
public int getRetryInitialWaitSeconds() { | ||
return retryInitialWaitSeconds; | ||
} | ||
|
||
public void setRetryInitialWaitSeconds(int retryInitialWaitSeconds) { | ||
this.retryInitialWaitSeconds = retryInitialWaitSeconds; | ||
} | ||
|
||
public int getRetryMaximumWaitSeconds() { | ||
return retryMaximumWaitSeconds; | ||
} | ||
|
||
public void setRetryMaximumWaitSeconds(int retryMaximumWaitSeconds) { | ||
this.retryMaximumWaitSeconds = retryMaximumWaitSeconds; | ||
} | ||
|
||
public int getOperationTimeoutSeconds() { | ||
return operationTimeoutSeconds; | ||
} | ||
|
||
public void setOperationTimeoutSeconds(int operationTimeoutSeconds) { | ||
this.operationTimeoutSeconds = operationTimeoutSeconds; | ||
} | ||
} | ||
@ConstructorBinding | ||
public record SamConfiguration( | ||
String basePath, | ||
String stewardsGroupEmail, | ||
String adminsGroupEmail, | ||
int retryInitialWaitSeconds, | ||
int retryMaximumWaitSeconds, | ||
int operationTimeoutSeconds) {} |
Oops, something went wrong.