I am using the Java sdk to try and automate some azure tasks like start a server and shutdown a server. I was using version 0.9.0 of the java sdk from the maven
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-compute</artifactId>
<version>0.9.0</version>
</dependency>
This code compiled and ran successfully in eclipse
package com.services.servers.operations.azure;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import com.microsoft.windowsazure.Configuration;
import com.microsoft.windowsazure.core.utils.KeyStoreType;
import com.microsoft.windowsazure.exception.ServiceException;
import com.microsoft.windowsazure.management.compute.ComputeManagementClient;
import com.microsoft.windowsazure.management.compute.ComputeManagementService;
import com.microsoft.windowsazure.management.compute.VirtualMachineOperations;
import com.microsoft.windowsazure.management.configuration.ManagementConfiguration;
public class AzureTest {
String uri = "https://management.core.windows.net/";
String subscriptionId = "dasdas9-86da-4343-a1f4-24c20864e166";
String keyStoreLocation = "C:\\Users\\test\\Desktop\\azure\\testKeystore.jks";
String keyStorePassword = "password";
public boolean startVirtualMachine(String serviceName, String deploymentName, String virtualMachineName){
boolean isSuccess = true;
try {
VirtualMachineOperations virtualMachineOperations = null;
Configuration config = ManagementConfiguration.configure(
new URI(uri),
subscriptionId,
keyStoreLocation,
keyStorePassword,
KeyStoreType.jks
);
ComputeManagementClient computeManagementClient = ComputeManagementService.create(config);
virtualMachineOperations = computeManagementClient.getVirtualMachinesOperations();
virtualMachineOperations.beginStarting(serviceName, deploymentName, virtualMachineName);
} catch (IOException e) {
System.out.println("An IOException has occured. Exception: " +e);
isSuccess = false;
} catch (ServiceException e) {
System.out.println("A ServiceException has occured. Exception: " + e);
isSuccess = false;
} catch (URISyntaxException e) {
System.out.println("A URISyntaxException has occured. Exception: " + e);
isSuccess = false;
}
return isSuccess;
}
}
When I upgrade to the latest version of the sdk - 0.9.1 - the following classes dont exist any longer
import com.microsoft.windowsazure.Configuration;
import com.microsoft.windowsazure.core.utils.KeyStoreType;
import com.microsoft.windowsazure.exception.ServiceException;
import com.microsoft.windowsazure.management.configuration.ManagementConfiguration;
I couldnt find anything online to state where these classes have gone to - whether they have been deprecated or more to another lib
If anyone has any idea what classes I should instead or what libs they may have moved to- that would be great Or if anyone can suggest any improvements to the above code for starting a server that would be much appreciated
Thanks Damien