-
Notifications
You must be signed in to change notification settings - Fork 25.6k
S3 repository: Add named configurations #22762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2b51624
f711224
28c1e5e
efef46b
6cbe091
1590fea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,139 +19,146 @@ | |
|
|
||
| package org.elasticsearch.cloud.aws; | ||
|
|
||
| import java.util.Locale; | ||
| import java.util.function.Function; | ||
|
|
||
| import com.amazonaws.ClientConfiguration; | ||
| import com.amazonaws.Protocol; | ||
| import com.amazonaws.services.s3.AmazonS3; | ||
| import org.elasticsearch.common.component.LifecycleComponent; | ||
| import org.elasticsearch.common.settings.SecureSetting; | ||
| import org.elasticsearch.common.settings.SecureString; | ||
| import org.elasticsearch.common.settings.Setting; | ||
| import org.elasticsearch.common.settings.Setting.Property; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.common.unit.TimeValue; | ||
|
|
||
| import java.util.Locale; | ||
| import java.util.function.Function; | ||
|
|
||
| public interface AwsS3Service extends LifecycleComponent { | ||
|
|
||
| // Global AWS settings (shared between discovery-ec2 and repository-s3) | ||
| // Legacy global AWS settings (shared between discovery-ec2 and repository-s3) | ||
| // Each setting starting with `cloud.aws` also exists in discovery-ec2 project. Don't forget to update | ||
| // the code there if you change anything here. | ||
| /** | ||
| * cloud.aws.access_key: AWS Access key. Shared with discovery-ec2 plugin | ||
| */ | ||
| SecureSetting<SecureString> KEY_SETTING = SecureSetting.secureString("cloud.aws.access_key", null, true, Property.Shared); | ||
|
|
||
| Setting<SecureString> KEY_SETTING = new Setting<>("cloud.aws.access_key", "", SecureString::new, | ||
| Property.NodeScope, Property.Filtered, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.secret_key: AWS Secret key. Shared with discovery-ec2 plugin | ||
| */ | ||
| SecureSetting<SecureString> SECRET_SETTING = SecureSetting.secureString("cloud.aws.secret_key", null, true, Property.Shared); | ||
| Setting<SecureString> SECRET_SETTING = new Setting<>("cloud.aws.secret_key", "", SecureString::new, | ||
| Property.NodeScope, Property.Filtered, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.protocol: Protocol for AWS API: http or https. Defaults to https. Shared with discovery-ec2 plugin | ||
| */ | ||
| Setting<Protocol> PROTOCOL_SETTING = new Setting<>("cloud.aws.protocol", "https", s -> Protocol.valueOf(s.toUpperCase(Locale.ROOT)), | ||
| Property.NodeScope, Property.Shared); | ||
| Setting<Protocol> PROTOCOL_SETTING = new Setting<>("cloud.aws.protocol", "https", | ||
| s -> Protocol.valueOf(s.toUpperCase(Locale.ROOT)), Property.NodeScope, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.proxy.host: In case of proxy, define its hostname/IP. Shared with discovery-ec2 plugin | ||
| */ | ||
| Setting<String> PROXY_HOST_SETTING = Setting.simpleString("cloud.aws.proxy.host", Property.NodeScope, Property.Shared); | ||
| Setting<String> PROXY_HOST_SETTING = Setting.simpleString("cloud.aws.proxy.host", | ||
| Property.NodeScope, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.proxy.port: In case of proxy, define its port. Defaults to 80. Shared with discovery-ec2 plugin | ||
| */ | ||
| Setting<Integer> PROXY_PORT_SETTING = Setting.intSetting("cloud.aws.proxy.port", 80, 0, 1<<16, Property.NodeScope, | ||
| Property.Shared); | ||
| Setting<Integer> PROXY_PORT_SETTING = Setting.intSetting("cloud.aws.proxy.port", 80, 0, 1<<16, | ||
| Property.NodeScope, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.proxy.username: In case of proxy with auth, define the username. Shared with discovery-ec2 plugin | ||
| */ | ||
| SecureSetting<SecureString> PROXY_USERNAME_SETTING = | ||
| SecureSetting.secureString("cloud.aws.proxy.username", null, true, Property.Shared); | ||
|
|
||
| Setting<SecureString> PROXY_USERNAME_SETTING = new Setting<>("cloud.aws.proxy.username", "", SecureString::new, | ||
| Property.NodeScope, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.proxy.password: In case of proxy with auth, define the password. Shared with discovery-ec2 plugin | ||
| */ | ||
| SecureSetting<SecureString> PROXY_PASSWORD_SETTING = | ||
| SecureSetting.secureString("cloud.aws.proxy.password", null, true, Property.Shared); | ||
| Setting<SecureString> PROXY_PASSWORD_SETTING = new Setting<>("cloud.aws.proxy.password", "", SecureString::new, | ||
| Property.NodeScope, Property.Filtered, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.signer: If you are using an old AWS API version, you can define a Signer. Shared with discovery-ec2 plugin | ||
| */ | ||
| Setting<String> SIGNER_SETTING = Setting.simpleString("cloud.aws.signer", Property.NodeScope, Property.Shared); | ||
| Setting<String> SIGNER_SETTING = Setting.simpleString("cloud.aws.signer", | ||
| Property.NodeScope, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.region: Region. Shared with discovery-ec2 plugin | ||
| */ | ||
| Setting<String> REGION_SETTING = | ||
| new Setting<>("cloud.aws.region", "", s -> s.toLowerCase(Locale.ROOT), Property.NodeScope, Property.Shared); | ||
| Setting<String> REGION_SETTING = new Setting<>("cloud.aws.region", "", s -> s.toLowerCase(Locale.ROOT), | ||
| Property.NodeScope, Property.Deprecated, Property.Shared); | ||
| /** | ||
| * cloud.aws.read_timeout: Socket read timeout. Shared with discovery-ec2 plugin | ||
| */ | ||
| Setting<TimeValue> READ_TIMEOUT = Setting.timeSetting("cloud.aws.read_timeout", | ||
| TimeValue.timeValueMillis(ClientConfiguration.DEFAULT_SOCKET_TIMEOUT), Property.NodeScope, Property.Shared); | ||
| TimeValue.timeValueMillis(ClientConfiguration.DEFAULT_SOCKET_TIMEOUT), Property.NodeScope, Property.Deprecated, Property.Shared); | ||
|
|
||
| /** | ||
| * Defines specific s3 settings starting with cloud.aws.s3. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also add |
||
| * NOTE: These are legacy settings. Use the named client configs in {@link org.elasticsearch.repositories.s3.S3Repository}. | ||
| */ | ||
| interface CLOUD_S3 { | ||
| /** | ||
| * cloud.aws.s3.access_key: AWS Access key specific for S3 API calls. Defaults to cloud.aws.access_key. | ||
| * @see AwsS3Service#KEY_SETTING | ||
| */ | ||
| SecureSetting<SecureString> KEY_SETTING = SecureSetting.secureString("cloud.aws.s3.access_key", AwsS3Service.KEY_SETTING, true); | ||
| Setting<SecureString> KEY_SETTING = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And also rename them as you did for the So here And same applies for the other
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually reverted the rename to LEGACY, I don't think it helps with much, it is confusing either way. The settings are going away in master in a followup anyways. |
||
| new Setting<>("cloud.aws.s3.access_key", AwsS3Service.KEY_SETTING, SecureString::new, | ||
| Property.NodeScope, Property.Filtered, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.secret_key: AWS Secret key specific for S3 API calls. Defaults to cloud.aws.secret_key. | ||
| * @see AwsS3Service#SECRET_SETTING | ||
| */ | ||
| SecureSetting<SecureString> SECRET_SETTING = SecureSetting.secureString("cloud.aws.s3.secret_key", | ||
| AwsS3Service.SECRET_SETTING, true); | ||
| Setting<SecureString> SECRET_SETTING = | ||
| new Setting<>("cloud.aws.s3.secret_key", AwsS3Service.SECRET_SETTING, SecureString::new, | ||
| Property.NodeScope, Property.Filtered, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.protocol: Protocol for AWS API specific for S3 API calls: http or https. Defaults to cloud.aws.protocol. | ||
| * @see AwsS3Service#PROTOCOL_SETTING | ||
| */ | ||
| Setting<Protocol> PROTOCOL_SETTING = | ||
| new Setting<>("cloud.aws.s3.protocol", AwsS3Service.PROTOCOL_SETTING, s -> Protocol.valueOf(s.toUpperCase(Locale.ROOT)), | ||
| Property.NodeScope); | ||
| Property.NodeScope, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.proxy.host: In case of proxy, define its hostname/IP specific for S3 API calls. Defaults to cloud.aws.proxy.host. | ||
| * @see AwsS3Service#PROXY_HOST_SETTING | ||
| */ | ||
| Setting<String> PROXY_HOST_SETTING = | ||
| new Setting<>("cloud.aws.s3.proxy.host", AwsS3Service.PROXY_HOST_SETTING, Function.identity(), | ||
| Property.NodeScope); | ||
| Property.NodeScope, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.proxy.port: In case of proxy, define its port specific for S3 API calls. Defaults to cloud.aws.proxy.port. | ||
| * @see AwsS3Service#PROXY_PORT_SETTING | ||
| */ | ||
| Setting<Integer> PROXY_PORT_SETTING = | ||
| new Setting<>("cloud.aws.s3.proxy.port", AwsS3Service.PROXY_PORT_SETTING, | ||
| s -> Setting.parseInt(s, 0, 1<<16, "cloud.aws.s3.proxy.port"), Property.NodeScope); | ||
| s -> Setting.parseInt(s, 0, 1<<16, "cloud.aws.s3.proxy.port"), Property.NodeScope, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.proxy.username: In case of proxy with auth, define the username specific for S3 API calls. | ||
| * Defaults to cloud.aws.proxy.username. | ||
| * @see AwsS3Service#PROXY_USERNAME_SETTING | ||
| */ | ||
| SecureSetting<SecureString> PROXY_USERNAME_SETTING = | ||
| SecureSetting.secureString("cloud.aws.s3.proxy.username", AwsS3Service.PROXY_USERNAME_SETTING, true); | ||
| Setting<SecureString> PROXY_USERNAME_SETTING = | ||
| new Setting<>("cloud.aws.s3.proxy.username", AwsS3Service.PROXY_USERNAME_SETTING, SecureString::new, | ||
| Property.NodeScope, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.proxy.password: In case of proxy with auth, define the password specific for S3 API calls. | ||
| * Defaults to cloud.aws.proxy.password. | ||
| * @see AwsS3Service#PROXY_PASSWORD_SETTING | ||
| */ | ||
| SecureSetting<SecureString> PROXY_PASSWORD_SETTING = | ||
| SecureSetting.secureString("cloud.aws.s3.proxy.password", AwsS3Service.PROXY_PASSWORD_SETTING, true); | ||
|
|
||
| Setting<SecureString> PROXY_PASSWORD_SETTING = | ||
| new Setting<>("cloud.aws.s3.proxy.password", AwsS3Service.PROXY_PASSWORD_SETTING, SecureString::new, | ||
| Property.NodeScope, Property.Filtered, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.signer: If you are using an old AWS API version, you can define a Signer. Specific for S3 API calls. | ||
| * Defaults to cloud.aws.signer. | ||
| * @see AwsS3Service#SIGNER_SETTING | ||
| */ | ||
| Setting<String> SIGNER_SETTING = | ||
| new Setting<>("cloud.aws.s3.signer", AwsS3Service.SIGNER_SETTING, Function.identity(), Property.NodeScope); | ||
| new Setting<>("cloud.aws.s3.signer", AwsS3Service.SIGNER_SETTING, Function.identity(), | ||
| Property.NodeScope, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.region: Region specific for S3 API calls. Defaults to cloud.aws.region. | ||
| * @see AwsS3Service#REGION_SETTING | ||
| */ | ||
| Setting<String> REGION_SETTING = | ||
| new Setting<>("cloud.aws.s3.region", AwsS3Service.REGION_SETTING, s -> s.toLowerCase(Locale.ROOT), | ||
| Property.NodeScope); | ||
| Property.NodeScope, Property.Deprecated); | ||
| /** | ||
| * cloud.aws.s3.endpoint: Endpoint. If not set, endpoint will be guessed based on region setting. | ||
| */ | ||
|
|
@@ -161,9 +168,8 @@ interface CLOUD_S3 { | |
| * @see AwsS3Service#READ_TIMEOUT | ||
| */ | ||
| Setting<TimeValue> READ_TIMEOUT = | ||
| Setting.timeSetting("cloud.aws.s3.read_timeout", AwsS3Service.READ_TIMEOUT, Property.NodeScope); | ||
| Setting.timeSetting("cloud.aws.s3.read_timeout", AwsS3Service.READ_TIMEOUT, Property.NodeScope, Property.Deprecated); | ||
| } | ||
|
|
||
| AmazonS3 client(Settings repositorySettings, String endpoint, Protocol protocol, String region, Integer maxRetries, | ||
| boolean useThrottleRetries, Boolean pathStyleAccess); | ||
| AmazonS3 client(Settings repositorySettings, Integer maxRetries, boolean useThrottleRetries, Boolean pathStyleAccess); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something we should mark as
Deprecatedso we know that this will go away and that we need to remove old APIs which are using that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this in f711224.