22
22
import com .amazonaws .ClientConfiguration ;
23
23
import com .amazonaws .Protocol ;
24
24
import com .amazonaws .services .ec2 .AmazonEC2 ;
25
+ import org .elasticsearch .common .settings .SecureSetting ;
26
+ import org .elasticsearch .common .settings .SecureString ;
25
27
import org .elasticsearch .common .settings .Setting ;
26
28
import org .elasticsearch .common .settings .Setting .Property ;
27
29
import org .elasticsearch .common .settings .Settings ;
@@ -42,50 +44,52 @@ interface AwsEc2Service {
42
44
/**
43
45
* cloud.aws.access_key: AWS Access key. Shared with repository-s3 plugin
44
46
*/
45
- Setting <String > KEY_SETTING =
46
- Setting . simpleString ( "cloud.aws.access_key" , Property .NodeScope , Property .Filtered , Property .Shared );
47
+ Setting <SecureString > KEY_SETTING = new Setting <>( "cloud.aws.access_key" , "" , SecureString :: new ,
48
+ Property .NodeScope , Property .Filtered , Property .Shared , Property . Deprecated );
47
49
/**
48
50
* cloud.aws.secret_key: AWS Secret key. Shared with repository-s3 plugin
49
51
*/
50
- Setting <String > SECRET_SETTING =
51
- Setting . simpleString ( "cloud.aws.secret_key" , Property .NodeScope , Property .Filtered , Property .Shared );
52
+ Setting <SecureString > SECRET_SETTING = new Setting <>( "cloud.aws.secret_key" , "" , SecureString :: new ,
53
+ Property .NodeScope , Property .Filtered , Property .Shared , Property . Deprecated );
52
54
/**
53
55
* cloud.aws.protocol: Protocol for AWS API: http or https. Defaults to https. Shared with repository-s3 plugin
54
56
*/
55
57
Setting <Protocol > PROTOCOL_SETTING = new Setting <>("cloud.aws.protocol" , "https" , s -> Protocol .valueOf (s .toUpperCase (Locale .ROOT )),
56
- Property .NodeScope , Property .Shared );
58
+ Property .NodeScope , Property .Shared , Property . Deprecated );
57
59
/**
58
60
* cloud.aws.proxy.host: In case of proxy, define its hostname/IP. Shared with repository-s3 plugin
59
61
*/
60
- Setting <String > PROXY_HOST_SETTING = Setting .simpleString ("cloud.aws.proxy.host" , Property .NodeScope , Property .Shared );
62
+ Setting <String > PROXY_HOST_SETTING = Setting .simpleString ("cloud.aws.proxy.host" ,
63
+ Property .NodeScope , Property .Shared , Property .Deprecated );
61
64
/**
62
65
* cloud.aws.proxy.port: In case of proxy, define its port. Defaults to 80. Shared with repository-s3 plugin
63
66
*/
64
- Setting <Integer > PROXY_PORT_SETTING = Setting .intSetting ("cloud.aws.proxy.port" , 80 , 0 , 1 <<16 , Property . NodeScope ,
65
- Property .Shared );
67
+ Setting <Integer > PROXY_PORT_SETTING = Setting .intSetting ("cloud.aws.proxy.port" , 80 , 0 , 1 <<16 ,
68
+ Property .NodeScope , Property . Shared , Property . Deprecated );
66
69
/**
67
70
* cloud.aws.proxy.username: In case of proxy with auth, define the username. Shared with repository-s3 plugin
68
71
*/
69
- Setting <String > PROXY_USERNAME_SETTING = Setting .simpleString ("cloud.aws.proxy.username" , Property .NodeScope , Property .Shared );
72
+ Setting <SecureString > PROXY_USERNAME_SETTING = new Setting <>("cloud.aws.proxy.username" , "" , SecureString ::new ,
73
+ Property .NodeScope , Property .Filtered , Property .Shared , Property .Deprecated );
70
74
/**
71
75
* cloud.aws.proxy.password: In case of proxy with auth, define the password. Shared with repository-s3 plugin
72
76
*/
73
- Setting <String > PROXY_PASSWORD_SETTING =
74
- Setting . simpleString ( "cloud.aws.proxy.password" , Property .NodeScope , Property .Filtered , Property .Shared );
77
+ Setting <SecureString > PROXY_PASSWORD_SETTING = new Setting <>( "cloud.aws.proxy.password" , "" , SecureString :: new ,
78
+ Property .NodeScope , Property .Filtered , Property .Shared , Property . Deprecated );
75
79
/**
76
80
* cloud.aws.signer: If you are using an old AWS API version, you can define a Signer. Shared with repository-s3 plugin
77
81
*/
78
- Setting <String > SIGNER_SETTING = Setting .simpleString ("cloud.aws.signer" , Property .NodeScope , Property .Shared );
82
+ Setting <String > SIGNER_SETTING = Setting .simpleString ("cloud.aws.signer" , Property .NodeScope , Property .Shared , Property . Deprecated );
79
83
/**
80
84
* cloud.aws.region: Region. Shared with repository-s3 plugin
81
85
*/
82
86
Setting <String > REGION_SETTING =
83
- new Setting <>("cloud.aws.region" , "" , s -> s .toLowerCase (Locale .ROOT ), Property .NodeScope , Property .Shared );
87
+ new Setting <>("cloud.aws.region" , "" , s -> s .toLowerCase (Locale .ROOT ), Property .NodeScope , Property .Shared , Property . Deprecated );
84
88
/**
85
89
* cloud.aws.read_timeout: Socket read timeout. Shared with repository-s3 plugin
86
90
*/
87
91
Setting <TimeValue > READ_TIMEOUT = Setting .timeSetting ("cloud.aws.read_timeout" ,
88
- TimeValue .timeValueMillis (ClientConfiguration .DEFAULT_SOCKET_TIMEOUT ), Property .NodeScope , Property .Shared );
92
+ TimeValue .timeValueMillis (ClientConfiguration .DEFAULT_SOCKET_TIMEOUT ), Property .NodeScope , Property .Shared , Property . Deprecated );
89
93
90
94
/**
91
95
* Defines specific ec2 settings starting with cloud.aws.ec2.
@@ -95,69 +99,70 @@ interface CLOUD_EC2 {
95
99
* cloud.aws.ec2.access_key: AWS Access key specific for EC2 API calls. Defaults to cloud.aws.access_key.
96
100
* @see AwsEc2Service#KEY_SETTING
97
101
*/
98
- Setting <String > KEY_SETTING = new Setting <>("cloud.aws.ec2.access_key" , AwsEc2Service .KEY_SETTING , Function .identity (),
99
- Property .NodeScope , Property .Filtered );
102
+ Setting <SecureString > KEY_SETTING = new Setting <>("cloud.aws.ec2.access_key" , AwsEc2Service .KEY_SETTING ,
103
+ SecureString ::new , Property .NodeScope , Property .Filtered , Property .Deprecated );
104
+
100
105
/**
101
106
* cloud.aws.ec2.secret_key: AWS Secret key specific for EC2 API calls. Defaults to cloud.aws.secret_key.
102
107
* @see AwsEc2Service#SECRET_SETTING
103
108
*/
104
- Setting <String > SECRET_SETTING = new Setting <>("cloud.aws.ec2.secret_key" , AwsEc2Service .SECRET_SETTING , Function . identity () ,
105
- Property .NodeScope , Property .Filtered );
109
+ Setting <SecureString > SECRET_SETTING = new Setting <>("cloud.aws.ec2.secret_key" , AwsEc2Service .SECRET_SETTING ,
110
+ SecureString :: new , Property .NodeScope , Property .Filtered , Property . Deprecated );
106
111
/**
107
112
* cloud.aws.ec2.protocol: Protocol for AWS API specific for EC2 API calls: http or https. Defaults to cloud.aws.protocol.
108
113
* @see AwsEc2Service#PROTOCOL_SETTING
109
114
*/
110
115
Setting <Protocol > PROTOCOL_SETTING = new Setting <>("cloud.aws.ec2.protocol" , AwsEc2Service .PROTOCOL_SETTING ,
111
- s -> Protocol .valueOf (s .toUpperCase (Locale .ROOT )), Property .NodeScope );
116
+ s -> Protocol .valueOf (s .toUpperCase (Locale .ROOT )), Property .NodeScope , Property . Deprecated );
112
117
/**
113
118
* cloud.aws.ec2.proxy.host: In case of proxy, define its hostname/IP specific for EC2 API calls. Defaults to cloud.aws.proxy.host.
114
119
* @see AwsEc2Service#PROXY_HOST_SETTING
115
120
*/
116
121
Setting <String > PROXY_HOST_SETTING = new Setting <>("cloud.aws.ec2.proxy.host" , AwsEc2Service .PROXY_HOST_SETTING ,
117
- Function .identity (), Property .NodeScope );
122
+ Function .identity (), Property .NodeScope , Property . Deprecated );
118
123
/**
119
124
* cloud.aws.ec2.proxy.port: In case of proxy, define its port specific for EC2 API calls. Defaults to cloud.aws.proxy.port.
120
125
* @see AwsEc2Service#PROXY_PORT_SETTING
121
126
*/
122
127
Setting <Integer > PROXY_PORT_SETTING = new Setting <>("cloud.aws.ec2.proxy.port" , AwsEc2Service .PROXY_PORT_SETTING ,
123
- s -> Setting .parseInt (s , 0 , 1 <<16 , "cloud.aws.ec2.proxy.port" ), Property .NodeScope );
128
+ s -> Setting .parseInt (s , 0 , 1 <<16 , "cloud.aws.ec2.proxy.port" ), Property .NodeScope , Property . Deprecated );
124
129
/**
125
130
* cloud.aws.ec2.proxy.username: In case of proxy with auth, define the username specific for EC2 API calls.
126
131
* Defaults to cloud.aws.proxy.username.
127
132
* @see AwsEc2Service#PROXY_USERNAME_SETTING
128
133
*/
129
- Setting <String > PROXY_USERNAME_SETTING = new Setting <>("cloud.aws.ec2.proxy.username" , AwsEc2Service .PROXY_USERNAME_SETTING ,
130
- Function . identity () , Property .NodeScope );
134
+ Setting <SecureString > PROXY_USERNAME_SETTING = new Setting <>("cloud.aws.ec2.proxy.username" , AwsEc2Service .PROXY_USERNAME_SETTING ,
135
+ SecureString :: new , Property .NodeScope , Property . Filtered , Property . Deprecated );
131
136
/**
132
137
* cloud.aws.ec2.proxy.password: In case of proxy with auth, define the password specific for EC2 API calls.
133
138
* Defaults to cloud.aws.proxy.password.
134
139
* @see AwsEc2Service#PROXY_PASSWORD_SETTING
135
140
*/
136
- Setting <String > PROXY_PASSWORD_SETTING = new Setting <>("cloud.aws.ec2.proxy.password" , AwsEc2Service .PROXY_PASSWORD_SETTING ,
137
- Function . identity () , Property .NodeScope , Property .Filtered );
141
+ Setting <SecureString > PROXY_PASSWORD_SETTING = new Setting <>("cloud.aws.ec2.proxy.password" , AwsEc2Service .PROXY_PASSWORD_SETTING ,
142
+ SecureString :: new , Property .NodeScope , Property .Filtered , Property . Deprecated );
138
143
/**
139
144
* cloud.aws.ec2.signer: If you are using an old AWS API version, you can define a Signer. Specific for EC2 API calls.
140
145
* Defaults to cloud.aws.signer.
141
146
* @see AwsEc2Service#SIGNER_SETTING
142
147
*/
143
148
Setting <String > SIGNER_SETTING = new Setting <>("cloud.aws.ec2.signer" , AwsEc2Service .SIGNER_SETTING , Function .identity (),
144
- Property .NodeScope );
149
+ Property .NodeScope , Property . Deprecated );
145
150
/**
146
151
* cloud.aws.ec2.region: Region specific for EC2 API calls. Defaults to cloud.aws.region.
147
152
* @see AwsEc2Service#REGION_SETTING
148
153
*/
149
154
Setting <String > REGION_SETTING = new Setting <>("cloud.aws.ec2.region" , AwsEc2Service .REGION_SETTING ,
150
- s -> s .toLowerCase (Locale .ROOT ), Property .NodeScope );
155
+ s -> s .toLowerCase (Locale .ROOT ), Property .NodeScope , Property . Deprecated );
151
156
/**
152
157
* cloud.aws.ec2.endpoint: Endpoint. If not set, endpoint will be guessed based on region setting.
153
158
*/
154
- Setting <String > ENDPOINT_SETTING = Setting .simpleString ("cloud.aws.ec2.endpoint" , Property .NodeScope );
159
+ Setting <String > ENDPOINT_SETTING = Setting .simpleString ("cloud.aws.ec2.endpoint" , Property .NodeScope , Property . Deprecated );
155
160
/**
156
161
* cloud.aws.ec2.read_timeout: Socket read timeout. Defaults to cloud.aws.read_timeout
157
162
* @see AwsEc2Service#READ_TIMEOUT
158
163
*/
159
164
Setting <TimeValue > READ_TIMEOUT =
160
- Setting .timeSetting ("cloud.aws.ec2.read_timeout" , AwsEc2Service .READ_TIMEOUT , Property .NodeScope );
165
+ Setting .timeSetting ("cloud.aws.ec2.read_timeout" , AwsEc2Service .READ_TIMEOUT , Property .NodeScope , Property . Deprecated );
161
166
}
162
167
163
168
/**
@@ -172,6 +177,40 @@ class HostType {
172
177
public static final String TAG_PREFIX = "tag:" ;
173
178
}
174
179
180
+ /** The access key (ie login id) for connecting to ec2. */
181
+ Setting <SecureString > ACCESS_KEY_SETTING = SecureSetting .secureString ("discovery.ec2.access_key" , CLOUD_EC2 .KEY_SETTING , false );
182
+
183
+ /** The secret key (ie password) for connecting to ec2. */
184
+ Setting <SecureString > SECRET_KEY_SETTING = SecureSetting .secureString ("discovery.ec2.secret_key" , CLOUD_EC2 .SECRET_SETTING , false );
185
+
186
+ /** An override for the ec2 endpoint to connect to. */
187
+ Setting <String > ENDPOINT_SETTING = new Setting <>("discovery.ec2.endpoint" , CLOUD_EC2 .ENDPOINT_SETTING ,
188
+ s -> s .toLowerCase (Locale .ROOT ), Setting .Property .NodeScope );
189
+
190
+ /** The protocol to use to connect to to ec2. */
191
+ Setting <Protocol > PROTOCOL_SETTING = new Setting <>("discovery.ec2.protocol" , CLOUD_EC2 .PROTOCOL_SETTING ,
192
+ s -> Protocol .valueOf (s .toUpperCase (Locale .ROOT )), Setting .Property .NodeScope );
193
+
194
+ /** The host name of a proxy to connect to ec2 through. */
195
+ Setting <String > PROXY_HOST_SETTING = new Setting <>("discovery.ec2.proxy.host" , CLOUD_EC2 .PROXY_HOST_SETTING ,
196
+ Function .identity (), Setting .Property .NodeScope );
197
+
198
+ /** The port of a proxy to connect to ec2 through. */
199
+ Setting <Integer > PROXY_PORT_SETTING = Setting .intSetting ("discovery.ec2.proxy.port" , CLOUD_EC2 .PROXY_PORT_SETTING ,
200
+ 0 , Setting .Property .NodeScope );
201
+
202
+ /** The username of a proxy to connect to s3 through. */
203
+ Setting <SecureString > PROXY_USERNAME_SETTING = SecureSetting .secureString ("discovery.ec2.proxy.username" ,
204
+ CLOUD_EC2 .PROXY_USERNAME_SETTING , false );
205
+
206
+ /** The password of a proxy to connect to s3 through. */
207
+ Setting <SecureString > PROXY_PASSWORD_SETTING = SecureSetting .secureString ("discovery.ec2.proxy.password" ,
208
+ CLOUD_EC2 .PROXY_PASSWORD_SETTING , false );
209
+
210
+ /** The socket timeout for connecting to s3. */
211
+ Setting <TimeValue > READ_TIMEOUT_SETTING = Setting .timeSetting ("discovery.ec2.read_timeout" ,
212
+ CLOUD_EC2 .READ_TIMEOUT , Setting .Property .NodeScope );
213
+
175
214
/**
176
215
* discovery.ec2.host_type: The type of host type to use to communicate with other instances.
177
216
* Can be one of private_ip, public_ip, private_dns, public_dns or tag:XXXX where
0 commit comments