public String getVirtualMachineStatus(String name) throws Exception { String status = ""; ArrayList<RoleInstance> roleInstances = computeManagementClient.getDeploymentsOperations().getBySlot(name, DeploymentSlot.Production).getRoleInstances(); for (RoleInstance instance : roleInstances) { if (instance.getRoleName().equals(name)) { status = instance.getInstanceStatus(); break; } } return status; }
@Override public void execCommand(String id, String command, String login, String key) { DeploymentGetResponse response = null; try { response = computeManagementClient.getDeploymentsOperations().getByName(id,id); } catch (IOException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } SSHConnector sc=new SSHConnector(key, login, response.getVirtualIPAddresses().get(0).getAddress().getHostAddress()); sc.execCommandSsh(command); }
result = new DeploymentGetResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); String nameInstance; nameInstance = nameElement.getTextContent(); result.setName(nameInstance); DeploymentSlot deploymentSlotInstance; deploymentSlotInstance = DeploymentSlot.valueOf(deploymentSlotElement.getTextContent()); result.setDeploymentSlot(deploymentSlotInstance); String privateIDInstance; privateIDInstance = privateIDElement.getTextContent(); result.setPrivateId(privateIDInstance); DeploymentStatus statusInstance; statusInstance = DeploymentStatus.valueOf(statusElement.getTextContent()); result.setStatus(statusInstance); String labelInstance; labelInstance = labelElement.getTextContent() != null ? new String(Base64.decode(labelElement.getTextContent())) : null; result.setLabel(labelInstance); URI urlInstance; urlInstance = new URI(urlElement.getTextContent()); result.setUri(urlInstance); String configurationInstance;
result = new DeploymentGetResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); String nameInstance; nameInstance = nameElement.getTextContent(); result.setName(nameInstance); DeploymentSlot deploymentSlotInstance; deploymentSlotInstance = DeploymentSlot.valueOf(deploymentSlotElement.getTextContent()); result.setDeploymentSlot(deploymentSlotInstance); String privateIDInstance; privateIDInstance = privateIDElement.getTextContent(); result.setPrivateId(privateIDInstance); DeploymentStatus statusInstance; statusInstance = DeploymentStatus.valueOf(statusElement.getTextContent()); result.setStatus(statusInstance); String labelInstance; labelInstance = labelElement.getTextContent() != null ? new String(Base64.decode(labelElement.getTextContent())) : null; result.setLabel(labelInstance); URI urlInstance; urlInstance = new URI(urlElement.getTextContent()); result.setUri(urlInstance); String configurationInstance;
result = new DeploymentGetResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); String nameInstance; nameInstance = nameElement.getTextContent(); result.setName(nameInstance); DeploymentSlot deploymentSlotInstance; deploymentSlotInstance = DeploymentSlot.valueOf(deploymentSlotElement.getTextContent()); result.setDeploymentSlot(deploymentSlotInstance); String privateIDInstance; privateIDInstance = privateIDElement.getTextContent(); result.setPrivateId(privateIDInstance); DeploymentStatus statusInstance; statusInstance = DeploymentStatus.valueOf(statusElement.getTextContent()); result.setStatus(statusInstance); String labelInstance; labelInstance = labelElement.getTextContent() != null ? new String(Base64.decode(labelElement.getTextContent())) : null; result.setLabel(labelInstance); URI urlInstance; urlInstance = new URI(urlElement.getTextContent()); result.setUri(urlInstance); String configurationInstance;
String ip=response.getVirtualIPAddresses().get(0).getAddress().getHostAddress(); runtimeInformation.put("publicAddress", ip); a.setId(a.getName());
result = new DeploymentGetResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); String nameInstance; nameInstance = nameElement.getTextContent(); result.setName(nameInstance); DeploymentSlot deploymentSlotInstance; deploymentSlotInstance = DeploymentSlot.valueOf(deploymentSlotElement.getTextContent()); result.setDeploymentSlot(deploymentSlotInstance); String privateIDInstance; privateIDInstance = privateIDElement.getTextContent(); result.setPrivateId(privateIDInstance); DeploymentStatus statusInstance; statusInstance = DeploymentStatus.valueOf(statusElement.getTextContent()); result.setStatus(statusInstance); String labelInstance; labelInstance = labelElement.getTextContent() != null ? new String(Base64.decode(labelElement.getTextContent())) : null; result.setLabel(labelInstance); URI urlInstance; urlInstance = new URI(urlElement.getTextContent()); result.setUri(urlInstance); String configurationInstance;