20
20
package org .elasticsearch .cloud .azure ;
21
21
22
22
import org .elasticsearch .ElasticsearchException ;
23
- import org .elasticsearch .cloud .azure .storage .AzureStorageService ;
24
- import org .elasticsearch .cloud .azure .storage .AzureStorageServiceImpl ;
25
23
import org .elasticsearch .cloud .azure .management .AzureComputeService ;
24
+ import org .elasticsearch .cloud .azure .management .AzureComputeService .Discovery ;
25
+ import org .elasticsearch .cloud .azure .management .AzureComputeService .Management ;
26
26
import org .elasticsearch .cloud .azure .management .AzureComputeServiceImpl ;
27
+ import org .elasticsearch .cloud .azure .storage .AzureStorageService ;
28
+ import org .elasticsearch .cloud .azure .storage .AzureStorageService .Storage ;
29
+ import org .elasticsearch .cloud .azure .storage .AzureStorageServiceImpl ;
27
30
import org .elasticsearch .common .Strings ;
28
31
import org .elasticsearch .common .inject .AbstractModule ;
29
32
import org .elasticsearch .common .inject .Inject ;
@@ -63,15 +66,15 @@ protected void configure() {
63
66
if (isDiscoveryReady (settings , logger )) {
64
67
logger .debug ("starting azure discovery service" );
65
68
bind (AzureComputeService .class )
66
- .to (settings .getAsClass ("cloud.azure.api.impl" , AzureComputeServiceImpl .class ))
69
+ .to (settings .getAsClass (Management . API_IMPLEMENTATION , AzureComputeServiceImpl .class ))
67
70
.asEagerSingleton ();
68
71
}
69
72
70
73
// If we have settings for azure repository, let's start the azure storage service
71
74
if (isSnapshotReady (settings , logger )) {
72
75
logger .debug ("starting azure repository service" );
73
76
bind (AzureStorageService .class )
74
- .to (settings .getAsClass ("repositories.azure.api.impl" , AzureStorageServiceImpl .class ))
77
+ .to (settings .getAsClass (Storage . API_IMPLEMENTATION , AzureStorageServiceImpl .class ))
75
78
.asEagerSingleton ();
76
79
}
77
80
}
@@ -102,22 +105,22 @@ public static boolean isDiscoveryReady(Settings settings, ESLogger logger) {
102
105
}
103
106
104
107
if ( // We check new parameters
105
- (isPropertyMissing (settings , "cloud.azure.management." + AzureComputeService . Fields .SUBSCRIPTION_ID ) ||
106
- isPropertyMissing (settings , "cloud.azure.management." + AzureComputeService . Fields .SERVICE_NAME ) ||
107
- isPropertyMissing (settings , "cloud.azure.management." + AzureComputeService . Fields .KEYSTORE_PATH ) ||
108
- isPropertyMissing (settings , "cloud.azure.management." + AzureComputeService . Fields .KEYSTORE_PASSWORD ))
108
+ (isPropertyMissing (settings , Management .SUBSCRIPTION_ID ) ||
109
+ isPropertyMissing (settings , Management .SERVICE_NAME ) ||
110
+ isPropertyMissing (settings , Management .KEYSTORE_PATH ) ||
111
+ isPropertyMissing (settings , Management .KEYSTORE_PASSWORD ))
109
112
// We check deprecated
110
- && (isPropertyMissing (settings , "cloud.azure." + AzureComputeService . Fields .SUBSCRIPTION_ID_DEPRECATED ) ||
111
- isPropertyMissing (settings , "cloud.azure." + AzureComputeService . Fields .SERVICE_NAME_DEPRECATED ) ||
112
- isPropertyMissing (settings , "cloud.azure." + AzureComputeService . Fields .KEYSTORE_DEPRECATED ) ||
113
- isPropertyMissing (settings , "cloud.azure." + AzureComputeService . Fields .PASSWORD_DEPRECATED ))
113
+ && (isPropertyMissing (settings , Management .SUBSCRIPTION_ID_DEPRECATED ) ||
114
+ isPropertyMissing (settings , Management .SERVICE_NAME_DEPRECATED ) ||
115
+ isPropertyMissing (settings , Management .KEYSTORE_DEPRECATED ) ||
116
+ isPropertyMissing (settings , Management .PASSWORD_DEPRECATED ))
114
117
) {
115
118
logger .debug ("one or more azure discovery settings are missing. " +
116
- "Check elasticsearch.yml file and `cloud.azure.management` . Should have [{}], [{}], [{}] and [{}]." ,
117
- AzureComputeService . Fields .SUBSCRIPTION_ID ,
118
- AzureComputeService . Fields .SERVICE_NAME ,
119
- AzureComputeService . Fields .KEYSTORE_PATH ,
120
- AzureComputeService . Fields .KEYSTORE_PASSWORD );
119
+ "Check elasticsearch.yml file. Should have [{}], [{}], [{}] and [{}]." ,
120
+ Management .SUBSCRIPTION_ID ,
121
+ Management .SERVICE_NAME ,
122
+ Management .KEYSTORE_PATH ,
123
+ Management .KEYSTORE_PASSWORD );
121
124
return false ;
122
125
}
123
126
@@ -137,13 +140,13 @@ public static boolean isSnapshotReady(Settings settings, ESLogger logger) {
137
140
return false ;
138
141
}
139
142
140
- if ((isPropertyMissing (settings , "cloud.azure.storage." + AzureStorageService . Fields .ACCOUNT ) ||
141
- isPropertyMissing (settings , "cloud.azure.storage." + AzureStorageService . Fields .KEY )) &&
142
- (isPropertyMissing (settings , "cloud.azure." + AzureStorageService . Fields .ACCOUNT_DEPRECATED ) ||
143
- isPropertyMissing (settings , "cloud.azure." + AzureStorageService . Fields .KEY_DEPRECATED ))) {
144
- logger .debug ("azure repository is not set [ using cloud.azure.storage. {}] and [cloud.azure.storage. {}] properties" ,
145
- AzureStorageService . Fields .ACCOUNT ,
146
- AzureStorageService . Fields .KEY );
143
+ if ((isPropertyMissing (settings , Storage .ACCOUNT ) ||
144
+ isPropertyMissing (settings , Storage .KEY )) &&
145
+ (isPropertyMissing (settings , Storage .ACCOUNT_DEPRECATED ) ||
146
+ isPropertyMissing (settings , Storage .KEY_DEPRECATED ))) {
147
+ logger .debug ("azure repository is not set using [ {}] and [{}] properties" ,
148
+ Storage .ACCOUNT ,
149
+ Storage .KEY );
147
150
return false ;
148
151
}
149
152
@@ -171,24 +174,16 @@ public static void checkDeprecatedSettings(Settings settings, String oldParamete
171
174
public static void checkDeprecated (Settings settings , ESLogger logger ) {
172
175
// Cloud services are disabled
173
176
if (isCloudReady (settings )) {
174
- checkDeprecatedSettings (settings , "cloud.azure." + AzureStorageService .Fields .ACCOUNT_DEPRECATED ,
175
- "cloud.azure.storage." + AzureStorageService .Fields .ACCOUNT , logger );
176
- checkDeprecatedSettings (settings , "cloud.azure." + AzureStorageService .Fields .KEY_DEPRECATED ,
177
- "cloud.azure.storage." + AzureStorageService .Fields .KEY , logger );
177
+ checkDeprecatedSettings (settings , Storage .ACCOUNT_DEPRECATED , Storage .ACCOUNT , logger );
178
+ checkDeprecatedSettings (settings , Storage .KEY_DEPRECATED , Storage .KEY , logger );
178
179
179
180
// TODO Remove in 3.0.0
180
- checkDeprecatedSettings (settings , "cloud.azure." + AzureComputeService .Fields .KEYSTORE_DEPRECATED ,
181
- "cloud.azure.management." + AzureComputeService .Fields .KEYSTORE_PATH , logger );
182
- checkDeprecatedSettings (settings , "cloud.azure." + AzureComputeService .Fields .PASSWORD_DEPRECATED ,
183
- "cloud.azure.management." + AzureComputeService .Fields .KEYSTORE_PASSWORD , logger );
184
- checkDeprecatedSettings (settings , "cloud.azure." + AzureComputeService .Fields .SERVICE_NAME_DEPRECATED ,
185
- "cloud.azure.management." + AzureComputeService .Fields .SERVICE_NAME , logger );
186
- checkDeprecatedSettings (settings , "cloud.azure." + AzureComputeService .Fields .SUBSCRIPTION_ID_DEPRECATED ,
187
- "cloud.azure.management." + AzureComputeService .Fields .SUBSCRIPTION_ID , logger );
188
- checkDeprecatedSettings (settings , "cloud.azure." + AzureComputeService .Fields .HOST_TYPE_DEPRECATED ,
189
- "discovery.azure." + AzureComputeService .Fields .HOST_TYPE , logger );
190
- checkDeprecatedSettings (settings , "cloud.azure." + AzureComputeService .Fields .PORT_NAME_DEPRECATED ,
191
- "discovery.azure." + AzureComputeService .Fields .ENDPOINT_NAME , logger );
181
+ checkDeprecatedSettings (settings , Management .KEYSTORE_DEPRECATED , Management .KEYSTORE_PATH , logger );
182
+ checkDeprecatedSettings (settings , Management .PASSWORD_DEPRECATED , Management .KEYSTORE_PASSWORD , logger );
183
+ checkDeprecatedSettings (settings , Management .SERVICE_NAME_DEPRECATED , Management .SERVICE_NAME , logger );
184
+ checkDeprecatedSettings (settings , Management .SUBSCRIPTION_ID_DEPRECATED , Management .SUBSCRIPTION_ID , logger );
185
+ checkDeprecatedSettings (settings , Discovery .HOST_TYPE_DEPRECATED , Discovery .HOST_TYPE , logger );
186
+ checkDeprecatedSettings (settings , Discovery .PORT_NAME_DEPRECATED , Discovery .ENDPOINT_NAME , logger );
192
187
}
193
188
}
194
189
0 commit comments