Skip to content

Commit 85ac406

Browse files
committed
Use Azure Java Management SDK 0.7.0
This first version adds `azure-management` 0.7.0 instead of using our own XML implementation. We can now have more control and give more options to the users. We now support different keystore types using `cloud.azure.management.keystore.type`: * `pkcs12` * `jceks` * `jks` Closes #38 (cherry picked from commit 72c77d3) (cherry picked from commit d2541ab)
1 parent 42509d0 commit 85ac406

16 files changed

+403
-553
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,15 @@ And add the following lines:
323323
# If you don't remember your account id, you may get it with `azure account list`
324324
cloud:
325325
azure:
326-
keystore: /home/elasticsearch/azurekeystore.pkcs12
327-
password: your_password_for_keystore
328-
subscription_id: your_azure_subscription_id
329-
service_name: your_azure_cloud_service_name
326+
management:
327+
subscription.id: your_azure_subscription_id
328+
cloud.service.name: your_azure_cloud_service_name
329+
keystore:
330+
path: /home/elasticsearch/azurekeystore.pkcs12
331+
password: your_password_for_keystore
332+
330333
discovery:
331-
type: azure
334+
type: azure
332335

333336
# Recommended (warning: non durable disk)
334337
# path.data: /mnt/resource/elasticsearch/data

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ governing permissions and limitations under the License. -->
7373
<version>2.0.0</version>
7474
</dependency>
7575

76+
<dependency>
77+
<groupId>com.microsoft.azure</groupId>
78+
<artifactId>azure-management-compute</artifactId>
79+
<version>0.7.0</version>
80+
</dependency>
81+
<dependency>
82+
<groupId>com.microsoft.azure</groupId>
83+
<artifactId>azure-management</artifactId>
84+
<version>0.7.0</version>
85+
</dependency>
86+
7687
<dependency>
7788
<groupId>log4j</groupId>
7889
<artifactId>log4j</artifactId>

src/main/assemblies/plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ governing permissions and limitations under the License. -->
3131
<useTransitiveFiltering>true</useTransitiveFiltering>
3232
<includes>
3333
<include>com.microsoft.azure:azure-storage</include>
34+
<include>com.microsoft.azure:azure-management</include>
35+
<include>com.microsoft.azure:azure-management-compute</include>
3436
</includes>
3537
</dependencySet>
3638
</dependencySets>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.cloud.azure;
21+
22+
import org.elasticsearch.ElasticsearchIllegalStateException;
23+
24+
public class AzureServiceDisableException extends ElasticsearchIllegalStateException {
25+
public AzureServiceDisableException() {
26+
super(null);
27+
}
28+
29+
public AzureServiceDisableException(String msg) {
30+
super(msg);
31+
}
32+
33+
public AzureServiceDisableException(String msg, Throwable cause) {
34+
super(msg, cause);
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.cloud.azure;
21+
22+
import org.elasticsearch.ElasticsearchIllegalStateException;
23+
24+
public class AzureServiceRemoteException extends ElasticsearchIllegalStateException {
25+
public AzureServiceRemoteException() {
26+
super(null);
27+
}
28+
29+
public AzureServiceRemoteException(String msg) {
30+
super(msg);
31+
}
32+
33+
public AzureServiceRemoteException(String msg, Throwable cause) {
34+
super(msg, cause);
35+
}
36+
}

src/main/java/org/elasticsearch/cloud/azure/AzureSettingsFilter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ public class AzureSettingsFilter implements SettingsFilter.Filter {
3131

3232
@Override
3333
public void filter(ImmutableSettings.Builder settings) {
34+
// Cloud global settings
35+
settings.remove("cloud.azure." + AzureComputeService.Fields.REFRESH);
36+
3437
// Cloud management API settings
3538
settings.remove("cloud.azure.management." + AzureComputeService.Fields.KEYSTORE_PATH);
3639
settings.remove("cloud.azure.management." + AzureComputeService.Fields.KEYSTORE_PASSWORD);
40+
settings.remove("cloud.azure.management." + AzureComputeService.Fields.KEYSTORE_TYPE);
3741
settings.remove("cloud.azure.management." + AzureComputeService.Fields.SUBSCRIPTION_ID);
3842
settings.remove("cloud.azure.management." + AzureComputeService.Fields.SERVICE_NAME);
3943

src/main/java/org/elasticsearch/cloud/azure/Instance.java

Lines changed: 0 additions & 113 deletions
This file was deleted.

src/main/java/org/elasticsearch/cloud/azure/management/AzureComputeService.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
package org.elasticsearch.cloud.azure.management;
2121

22-
import org.elasticsearch.cloud.azure.Instance;
23-
24-
import java.util.Set;
22+
import com.microsoft.windowsazure.management.compute.models.HostedServiceGetDetailedResponse;
2523

2624
/**
2725
*
@@ -49,12 +47,13 @@ static public final class Fields {
4947
// Keystore settings
5048
public static final String KEYSTORE_PATH = "keystore.path";
5149
public static final String KEYSTORE_PASSWORD = "keystore.password";
50+
public static final String KEYSTORE_TYPE = "keystore.type";
5251

5352
public static final String REFRESH = "refresh_interval";
5453

5554
public static final String HOST_TYPE = "host.type";
5655
public static final String ENDPOINT_NAME = "endpoint.name";
5756
}
5857

59-
public Set<Instance> instances();
58+
public HostedServiceGetDetailedResponse getServiceDetails();
6059
}

0 commit comments

Comments
 (0)