JCLOUDS-664 Updating Azure compute provider Renamed to azurecompute, removed dead code and refactored good code.
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/6ab58bd2 Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/6ab58bd2 Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/6ab58bd2 Branch: refs/heads/master Commit: 6ab58bd2ef0a644b1d5b7d65a6053cf6220c7165 Parents: bec869d Author: Adrian Cole <[email protected]> Authored: Tue Sep 30 21:51:46 2014 -0700 Committer: Andrew Phillips <[email protected]> Committed: Thu Oct 2 14:34:28 2014 -0700 ---------------------------------------------------------------------- azure-management/.gitignore | 9 - azure-management/README.txt | 8 - azure-management/pom.xml | 128 ----- .../azure/management/AzureManagementApi.java | 93 ---- .../management/AzureManagementApiMetadata.java | 92 ---- .../management/AzureManagementAsyncApi.java | 94 ---- .../AzureManagementProviderMetadata.java | 80 ---- .../BindCreateHostedServiceToXmlPayload.java | 82 ---- .../BindDeploymentParamsToXmlPayload.java | 139 ------ .../binders/BindOSImageParamsToXmlPayload.java | 48 -- .../AzureManagementComputeServiceAdapter.java | 125 ----- ...reManagementComputeServiceContextModule.java | 52 --- .../functions/DeploymentToNodeMetadata.java | 31 -- .../compute/functions/OSImageToImage.java | 31 -- .../compute/functions/RoleSizeToHardware.java | 31 -- .../config/AzureManagementProperties.java | 36 -- .../config/AzureManagementRestClientModule.java | 75 --- .../azure/management/domain/Deployment.java | 306 ------------ .../management/domain/DeploymentParams.java | 222 --------- .../azure/management/domain/DeploymentSlot.java | 43 -- .../management/domain/DeploymentStatus.java | 43 -- .../domain/DetailedHostedServiceProperties.java | 182 -------- .../jclouds/azure/management/domain/Disk.java | 463 ------------------- .../jclouds/azure/management/domain/Error.java | 250 ---------- .../azure/management/domain/HostedService.java | 195 -------- .../domain/HostedServiceProperties.java | 180 ------- .../HostedServiceWithDetailedProperties.java | 65 --- .../azure/management/domain/InputEndpoint.java | 139 ------ .../azure/management/domain/InstanceStatus.java | 155 ------- .../azure/management/domain/Location.java | 161 ------- .../azure/management/domain/OSImage.java | 306 ------------ .../azure/management/domain/OSImageParams.java | 177 ------- .../jclouds/azure/management/domain/OSType.java | 47 -- .../azure/management/domain/Operation.java | 210 --------- .../azure/management/domain/RoleSize.java | 43 -- .../domain/hostedservice/CreateDeployment.java | 214 --------- .../domain/hostedservice/ExtendedProperty.java | 102 ---- .../domain/hostedservice/package-info.java | 24 - .../management/domain/role/AbstractRole.java | 143 ------ .../azure/management/domain/role/DNS.java | 78 ---- .../azure/management/domain/role/DNSServer.java | 93 ---- .../domain/role/DataVirtualHardDisk.java | 57 --- .../management/domain/role/Deployment.java | 185 -------- .../management/domain/role/HostCaching.java | 29 -- .../domain/role/OSVirtualHardDisk.java | 66 --- .../domain/role/PersistentVMRole.java | 24 - .../azure/management/domain/role/Protocol.java | 31 -- .../azure/management/domain/role/Role.java | 24 - .../azure/management/domain/role/RoleSize.java | 36 -- .../management/domain/role/VirtualHardDisk.java | 88 ---- .../domain/role/conf/CertificateSetting.java | 78 ---- .../domain/role/conf/ConfigurationSet.java | 47 -- .../role/conf/ConfigurationSetAdapter.java | 150 ------ .../domain/role/conf/Credentials.java | 75 --- .../management/domain/role/conf/DomainJoin.java | 78 ---- .../domain/role/conf/InputEndpoint.java | 141 ------ .../management/domain/role/conf/KeyPair.java | 32 -- .../conf/LinuxProvisioningConfiguration.java | 105 ----- .../domain/role/conf/LoadBalancerProbe.java | 81 ---- .../domain/role/conf/NetworkConfiguration.java | 68 --- .../management/domain/role/conf/PublicKey.java | 32 -- .../azure/management/domain/role/conf/SSH.java | 67 --- .../management/domain/role/conf/SSHKey.java | 55 --- .../conf/WindowsProvisioningConfiguration.java | 140 ------ .../domain/role/conf/package-info.java | 25 - .../management/domain/role/package-info.java | 25 - .../azure/management/features/DiskApi.java | 43 -- .../azure/management/features/DiskAsyncApi.java | 71 --- .../management/features/HostedServiceApi.java | 136 ------ .../features/HostedServiceAsyncApi.java | 155 ------- .../azure/management/features/LocationApi.java | 40 -- .../management/features/LocationAsyncApi.java | 58 --- .../azure/management/features/OSImageApi.java | 63 --- .../management/features/OSImageAsyncApi.java | 95 ---- .../azure/management/features/OperationApi.java | 31 -- .../management/features/OperationAsyncApi.java | 55 --- .../azure/management/features/RoleApi.java | 72 --- .../azure/management/features/RoleAsyncApi.java | 137 ------ .../management/functions/OSImageParamsName.java | 37 -- .../functions/ParseRequestIdHeader.java | 46 -- .../options/CreateHostedServiceOptions.java | 126 ----- .../management/suppliers/KeyStoreSupplier.java | 133 ------ .../suppliers/SSLContextWithKeysSupplier.java | 83 ---- .../azure/management/xml/AttachmentHandler.java | 67 --- .../azure/management/xml/DeploymentHandler.java | 126 ----- .../DetailedHostedServicePropertiesHandler.java | 81 ---- .../azure/management/xml/DiskHandler.java | 119 ----- .../azure/management/xml/ErrorHandler.java | 68 --- .../management/xml/HostedServiceHandler.java | 109 ----- .../xml/HostedServicePropertiesHandler.java | 74 --- ...tedServiceWithDetailedPropertiesHandler.java | 44 -- .../azure/management/xml/ListDisksHandler.java | 88 ---- .../xml/ListHostedServicesHandler.java | 93 ---- .../management/xml/ListLocationsHandler.java | 88 ---- .../management/xml/ListOSImagesHandler.java | 88 ---- .../azure/management/xml/LocationHandler.java | 67 --- .../azure/management/xml/OSImageHandler.java | 92 ---- .../azure/management/xml/OperationHandler.java | 111 ----- .../org.jclouds.providers.ProviderMetadata | 1 - .../AzureManagementProviderMetadataTest.java | 28 -- .../management/features/DiskApiExpectTest.java | 81 ---- .../management/features/DiskApiLiveTest.java | 122 ----- .../features/HostedServiceApiExpectTest.java | 168 ------- .../features/HostedServiceApiLiveTest.java | 171 ------- .../features/LocationApiExpectTest.java | 59 --- .../features/LocationApiLiveTest.java | 61 --- .../features/OSImageApiExpectTest.java | 115 ----- .../management/features/OSImageApiLiveTest.java | 116 ----- .../features/OperationApiExpectTest.java | 55 --- .../management/features/RoleApiExpectTest.java | 173 ------- .../BaseAzureManagementApiExpectTest.java | 23 - .../BaseAzureManagementApiLiveTest.java | 51 -- .../BaseAzureManagementAsyncApiExpectTest.java | 32 -- .../internal/BaseAzureManagementExpectTest.java | 55 --- .../azure/management/parse/ErrorTest.java | 52 --- .../management/parse/GetDeploymentTest.java | 65 --- .../parse/GetHostedServiceDetailsTest.java | 67 --- .../management/parse/GetHostedServiceTest.java | 57 --- .../management/parse/GetOperationTest.java | 60 --- .../azure/management/parse/ListDisksTest.java | 73 --- .../parse/ListHostedServicesTest.java | 82 ---- .../management/parse/ListLocationsTest.java | 82 ---- .../management/parse/ListOSImagesTest.java | 122 ----- .../src/test/resources/azure-test.p12 | Bin 1536 -> 0 bytes .../src/test/resources/capturerolepayload.xml | 1 - .../resources/create_hostedservice_location.xml | 1 - .../create_hostedservice_location_options.xml | 1 - .../src/test/resources/deployment.xml | 70 --- .../src/test/resources/deploymentparams.xml | 1 - azure-management/src/test/resources/disks.xml | 23 - azure-management/src/test/resources/error.xml | 5 - .../src/test/resources/hostedservice.xml | 10 - .../test/resources/hostedservice_details.xml | 13 - .../src/test/resources/hostedservices.xml | 29 -- .../src/test/resources/imageparams.xml | 1 - azure-management/src/test/resources/images.xml | 75 --- .../src/test/resources/locations.xml | 57 --- .../src/test/resources/operation.xml | 10 - .../src/test/resources/restartrolepayload.xml | 1 - .../src/test/resources/shutdownrolepayload.xml | 1 - .../src/test/resources/startrolepayload.xml | 1 - azurecompute/.gitignore | 9 + azurecompute/README.md | 23 + azurecompute/pom.xml | 151 ++++++ .../jclouds/azurecompute/AzureComputeApi.java | 101 ++++ .../AzureComputeProviderMetadata.java | 78 ++++ .../AzureManagementApiMetadata.java | 80 ++++ .../BindCreateHostedServiceToXmlPayload.java | 79 ++++ .../BindDeploymentParamsToXmlPayload.java | 112 +++++ .../binders/BindOSImageParamsToXmlPayload.java | 46 ++ .../compute/AzureComputeServiceAdapter.java | 103 +++++ .../AzureComputeServiceContextModule.java | 48 ++ .../compute/functions/AzureImageToImage.java | 29 ++ .../functions/DeploymentToNodeMetadata.java | 30 ++ .../compute/functions/RoleSizeToHardware.java | 30 ++ .../config/AzureComputeHttpApiModule.java | 41 ++ .../config/AzureComputeProperties.java | 36 ++ .../jclouds/azurecompute/domain/Deployment.java | 309 +++++++++++++ .../azurecompute/domain/DeploymentParams.java | 208 +++++++++ .../azurecompute/domain/DeploymentSlot.java | 42 ++ .../azurecompute/domain/DeploymentStatus.java | 43 ++ .../domain/DetailedHostedServiceProperties.java | 173 +++++++ .../org/jclouds/azurecompute/domain/Disk.java | 442 ++++++++++++++++++ .../org/jclouds/azurecompute/domain/Error.java | 240 ++++++++++ .../azurecompute/domain/HostedService.java | 184 ++++++++ .../domain/HostedServiceProperties.java | 170 +++++++ .../HostedServiceWithDetailedProperties.java | 63 +++ .../org/jclouds/azurecompute/domain/Image.java | 298 ++++++++++++ .../azurecompute/domain/ImageParams.java | 165 +++++++ .../azurecompute/domain/InputEndpoint.java | 137 ++++++ .../azurecompute/domain/InstanceStatus.java | 155 +++++++ .../jclouds/azurecompute/domain/Location.java | 150 ++++++ .../org/jclouds/azurecompute/domain/OSType.java | 47 ++ .../jclouds/azurecompute/domain/Operation.java | 200 ++++++++ .../jclouds/azurecompute/domain/Protocol.java | 31 ++ .../jclouds/azurecompute/domain/RoleSize.java | 42 ++ .../azurecompute/features/DeploymentApi.java | 80 ++++ .../jclouds/azurecompute/features/DiskApi.java | 69 +++ .../azurecompute/features/HostedServiceApi.java | 157 +++++++ .../jclouds/azurecompute/features/ImageApi.java | 99 ++++ .../azurecompute/features/LocationApi.java | 54 +++ .../azurecompute/features/OperationApi.java | 48 ++ .../features/VirtualMachineApi.java | 87 ++++ .../azurecompute/functions/ImageParamsName.java | 34 ++ .../functions/ParseRequestIdHeader.java | 44 ++ .../options/CreateHostedServiceOptions.java | 116 +++++ .../suppliers/KeyStoreSupplier.java | 129 ++++++ .../suppliers/SSLContextWithKeysSupplier.java | 80 ++++ .../azurecompute/xml/AttachmentHandler.java | 58 +++ .../azurecompute/xml/DeploymentHandler.java | 115 +++++ .../DetailedHostedServicePropertiesHandler.java | 73 +++ .../jclouds/azurecompute/xml/DiskHandler.java | 107 +++++ .../jclouds/azurecompute/xml/ErrorHandler.java | 58 +++ .../azurecompute/xml/HostedServiceHandler.java | 93 ++++ .../xml/HostedServicePropertiesHandler.java | 64 +++ ...tedServiceWithDetailedPropertiesHandler.java | 42 ++ .../jclouds/azurecompute/xml/ImageHandler.java | 88 ++++ .../azurecompute/xml/ListDisksHandler.java | 73 +++ .../xml/ListHostedServicesHandler.java | 78 ++++ .../azurecompute/xml/ListImagesHandler.java | 73 +++ .../azurecompute/xml/ListLocationsHandler.java | 73 +++ .../azurecompute/xml/LocationHandler.java | 57 +++ .../azurecompute/xml/OperationHandler.java | 97 ++++ .../org.jclouds.providers.ProviderMetadata | 1 + .../AzureComputeProviderMetadataTest.java | 28 ++ .../features/DeploymentApiMockTest.java | 112 +++++ .../azurecompute/features/DiskApiLiveTest.java | 120 +++++ .../azurecompute/features/DiskApiMockTest.java | 89 ++++ .../features/HostedServiceApiLiveTest.java | 168 +++++++ .../features/HostedServiceApiMockTest.java | 186 ++++++++ .../azurecompute/features/ImageApiLiveTest.java | 110 +++++ .../azurecompute/features/ImageApiMockTest.java | 128 +++++ .../features/LocationApiLiveTest.java | 60 +++ .../features/LocationApiMockTest.java | 59 +++ .../features/OperationApiMockTest.java | 59 +++ .../features/VirtualMachineApiMockTest.java | 99 ++++ .../internal/BaseAzureComputeApiLiveTest.java | 39 ++ .../internal/BaseAzureComputeApiMockTest.java | 95 ++++ .../jclouds/azurecompute/parse/ErrorTest.java | 50 ++ .../azurecompute/parse/GetDeploymentTest.java | 62 +++ .../parse/GetHostedServiceDetailsTest.java | 65 +++ .../parse/GetHostedServiceTest.java | 55 +++ .../azurecompute/parse/GetOperationTest.java | 57 +++ .../azurecompute/parse/ListDisksTest.java | 71 +++ .../parse/ListHostedServicesTest.java | 79 ++++ .../azurecompute/parse/ListImagesTest.java | 117 +++++ .../azurecompute/parse/ListLocationsTest.java | 79 ++++ azurecompute/src/test/resources/azure-test.p12 | Bin 0 -> 1536 bytes .../src/test/resources/capturerolepayload.xml | 1 + .../resources/create_hostedservice_location.xml | 1 + .../create_hostedservice_location_options.xml | 1 + azurecompute/src/test/resources/deployment.xml | 70 +++ .../src/test/resources/deploymentparams.xml | 1 + azurecompute/src/test/resources/disks.xml | 23 + azurecompute/src/test/resources/error.xml | 5 + .../src/test/resources/hostedservice.xml | 10 + .../test/resources/hostedservice_details.xml | 13 + .../src/test/resources/hostedservices.xml | 29 ++ azurecompute/src/test/resources/imageparams.xml | 1 + azurecompute/src/test/resources/images.xml | 84 ++++ azurecompute/src/test/resources/locations.xml | 57 +++ azurecompute/src/test/resources/operation.xml | 10 + .../src/test/resources/restartrolepayload.xml | 1 + .../src/test/resources/shutdownrolepayload.xml | 1 + .../src/test/resources/startrolepayload.xml | 1 + pom.xml | 1 + 246 files changed, 8539 insertions(+), 11701 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/.gitignore ---------------------------------------------------------------------- diff --git a/azure-management/.gitignore b/azure-management/.gitignore deleted file mode 100644 index 83c270e..0000000 --- a/azure-management/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# use glob syntax. -syntax: glob -target -.settings -.classpath -.project -jclouds-azure-management.iml -jclouds-azure-management.ipr -jclouds-azure-management.iws http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/README.txt ---------------------------------------------------------------------- diff --git a/azure-management/README.txt b/azure-management/README.txt deleted file mode 100644 index 4136495..0000000 --- a/azure-management/README.txt +++ /dev/null @@ -1,8 +0,0 @@ - How to create the certificate : - - Create the .cer and pfx files using http://www.windowsazure4j.org/learn/labs/Management/index.html or http://msdn.microsoft.com/en-us/library/gg551722 - - Add it to azure : http://msdn.microsoft.com/en-us/library/gg551726 - - Generate the keystore http://stackoverflow.com/questions/4217107/how-to-convert-pfx-file-to-keystore-with-private-key - openssl pkcs12 -in certificate.pfx -out certificate.pem http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/pom.xml ---------------------------------------------------------------------- diff --git a/azure-management/pom.xml b/azure-management/pom.xml deleted file mode 100644 index 90664ff..0000000 --- a/azure-management/pom.xml +++ /dev/null @@ -1,128 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.jclouds.labs</groupId> - <artifactId>jclouds-labs</artifactId> - <version>2.0.0-SNAPSHOT</version> - </parent> - - <!-- TODO: when out of labs, switch to org.jclouds.provider --> - <groupId>org.apache.jclouds.labs</groupId> - <artifactId>azure-management</artifactId> - <name>jclouds azure-management api</name> - <description>jclouds components to access an implementation of Azure Management</description> - <packaging>bundle</packaging> - - <properties> - <test.jclouds.azure.management.subscription-id>FIXME_subscription-id</test.jclouds.azure.management.subscription-id> - <!-- note that there's no prefix of "test." in the url. This is to ensure that jclouds inteprets the value, as opposed to maven --> - <test.azure-management.endpoint>https://management.core.windows.net/${jclouds.azure.management.subscription-id}</test.azure-management.endpoint> - <test.azure-management.api-version>2012-03-01</test.azure-management.api-version> - <test.azure-management.build-version /> - <test.azure-management.identity>/path/to/cert.p12</test.azure-management.identity> - <test.azure-management.credential>password to cert</test.azure-management.credential> - <jclouds.osgi.export>org.jclouds.azure.management*;version="${project.version}"</jclouds.osgi.export> - <jclouds.osgi.import> - org.jclouds.rest.internal;version="${project.version}", - org.jclouds*;version="${project.version}", - * - </jclouds.osgi.import> - </properties> - - <dependencies> - <dependency> - <groupId>com.jamesmurty.utils</groupId> - <artifactId>java-xmlbuilder</artifactId> - <version>0.4</version> - </dependency> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-compute</artifactId> - <version>${jclouds.version}</version> - </dependency> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-compute</artifactId> - <version>${jclouds.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-core</artifactId> - <version>${jclouds.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.jclouds.driver</groupId> - <artifactId>jclouds-slf4j</artifactId> - <version>${jclouds.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.jclouds.driver</groupId> - <artifactId>jclouds-sshj</artifactId> - <version>${jclouds.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>live</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <id>integration</id> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <systemPropertyVariables> - <test.azure-management.endpoint>${test.azure-management.endpoint}</test.azure-management.endpoint> - <test.azure-management.api-version>${test.azure-management.api-version}</test.azure-management.api-version> - <test.azure-management.build-version>${test.azure-management.build-version}</test.azure-management.build-version> - <test.azure-management.identity>${test.azure-management.identity}</test.azure-management.identity> - <test.azure-management.credential>${test.azure-management.credential}</test.azure-management.credential> - <test.jclouds.azure.management.subscription-id>${test.jclouds.azure.management.subscription-id}</test.jclouds.azure.management.subscription-id> - </systemPropertyVariables> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - -</project> http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApi.java b/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApi.java deleted file mode 100644 index 3caec3a..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApi.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management; - -import org.jclouds.azure.management.features.DiskApi; -import org.jclouds.azure.management.features.HostedServiceApi; -import org.jclouds.azure.management.features.LocationApi; -import org.jclouds.azure.management.features.OSImageApi; -import org.jclouds.azure.management.features.OperationApi; -import org.jclouds.azure.management.features.RoleApi; -import org.jclouds.rest.annotations.Delegate; - -/** - * The Windows Azure Service Management API is a REST API for managing your services and - * deployments. - * <p/> - * - * @see AzureManagementAsyncApi - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460799" >doc</a> - */ -public interface AzureManagementApi { - /** - * The Service Management API includes operations for listing the available data center locations - * for a hosted service in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/gg441299">docs</a> - * @see AzureManagementAsyncApi#getLocationApi() - */ - @Delegate - LocationApi getLocationApi(); - - /** - * The Service Management API includes operations for managing the hosted services beneath your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460812">docs</a> - * @see AzureManagementAsyncApi#getHostedServiceApi() - */ - @Delegate - HostedServiceApi getHostedServiceApi(); - - /** - * The Service Management API includes operations for managing the virtual machines in your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157206">docs</a> - * @see AzureManagementAsyncApi#getRoleApi() - */ - @Delegate - RoleApi getRoleApi(); - - /** - * The Service Management API includes operations for managing the OS images in your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157175">docs</a> - * @see AzureManagementAsyncApi#getOSImageApi() - */ - @Delegate - OSImageApi getOSImageApi(); - - /** - * The Service Management API includes operations for Tracking Asynchronous Service Management Requests. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460791">docs</a> - * @see AzureManagementAsyncApi#getOperationApi() - */ - @Delegate - OperationApi getOperationApi(); - - /** - * The Service Management API includes operations for managing Disks in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157188">docs</a> - * @see AzureManagementAsyncApi#getDiskApi() - */ - @Delegate - DiskApi getDiskApi(); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApiMetadata.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApiMetadata.java b/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApiMetadata.java deleted file mode 100644 index d095522..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementApiMetadata.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management; -import static org.jclouds.azure.management.config.AzureManagementProperties.SUBSCRIPTION_ID; -import static org.jclouds.reflect.Reflection2.typeToken; - -import java.net.URI; -import java.util.Properties; - -import org.jclouds.apis.ApiMetadata; -import org.jclouds.azure.management.compute.config.AzureManagementComputeServiceContextModule; -import org.jclouds.azure.management.config.AzureManagementRestClientModule; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.internal.BaseRestApiMetadata; - -import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; -import com.google.inject.Module; - -/** - * Implementation of {@link ApiMetadata} for Microsoft Service Management Service API - */ -public class AzureManagementApiMetadata extends BaseRestApiMetadata { - - public static final TypeToken<RestContext<AzureManagementApi, AzureManagementAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<AzureManagementApi, AzureManagementAsyncApi>>() { - private static final long serialVersionUID = 1L; - }; - - private static Builder builder() { - return new Builder(); - } - - @Override - public Builder toBuilder() { - return builder().fromApiMetadata(this); - } - - public AzureManagementApiMetadata() { - this(builder()); - } - - protected AzureManagementApiMetadata(Builder builder) { - super(builder); - } - - public static Properties defaultProperties() { - Properties properties = BaseRestApiMetadata.defaultProperties(); - return properties; - } - - public static class Builder extends BaseRestApiMetadata.Builder<Builder> { - protected Builder() { - super(AzureManagementApi.class, AzureManagementAsyncApi.class); - id("azure-management") - .name("Microsoft Azure Service Management Service API") - .version("2012-03-01") - .identityName("Path to Management Certificate .p12 file, or PEM string") - .credentialName("Password to Management Certificate") - .defaultEndpoint("https://management.core.windows.net/${" + SUBSCRIPTION_ID + "}") - .endpointName("Service Management Endpoint ending in your Subscription Id") - .documentation(URI.create("http://msdn.microsoft.com/en-us/library/ee460799")) - .defaultProperties(AzureManagementApiMetadata.defaultProperties()) - .view(typeToken(ComputeServiceContext.class)) - .defaultModules(ImmutableSet.<Class<? extends Module>> of(AzureManagementComputeServiceContextModule.class, AzureManagementRestClientModule.class)); - } - - @Override - public AzureManagementApiMetadata build() { - return new AzureManagementApiMetadata(this); - } - - @Override - protected Builder self() { - return this; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementAsyncApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementAsyncApi.java b/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementAsyncApi.java deleted file mode 100644 index 3facdc3..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementAsyncApi.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management; - -import org.jclouds.azure.management.features.DiskAsyncApi; -import org.jclouds.azure.management.features.HostedServiceAsyncApi; -import org.jclouds.azure.management.features.LocationAsyncApi; -import org.jclouds.azure.management.features.OSImageAsyncApi; -import org.jclouds.azure.management.features.OperationAsyncApi; -import org.jclouds.azure.management.features.RoleAsyncApi; -import org.jclouds.rest.annotations.Delegate; - -/** - * The Windows Azure Service Management API is a REST API for managing your services and - * deployments. - * <p/> - * - * @see AzureManagementApi - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460799" >doc</a> - */ -public interface AzureManagementAsyncApi { - /** - * The Service Management API includes operations for listing the available data center locations - * for a hosted service in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/gg441299">docs</a> - * @see AzureManagementApi#getLocationApi() - */ - @Delegate - LocationAsyncApi getLocationApi(); - - /** - * The Service Management API includes operations for managing the hosted services beneath your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460812">docs</a> - * @see AzureManagementApi#getHostedServiceApi() - */ - @Delegate - HostedServiceAsyncApi getHostedServiceApi(); - - /** - * The Service Management API includes operations for managing the virtual machines in your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157206">docs</a> - * @see AzureManagementApi#getRoleApi() - */ - @Delegate - RoleAsyncApi getRoleApi(); - - /** - * The Service Management API includes operations for managing the OS images in your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157175">docs</a> - * @see AzureManagementApi#getOSImageApi() - */ - @Delegate - OSImageAsyncApi getOSImageApi(); - - /** - * The Service Management API includes operations for Tracking Asynchronous Service Management Requests. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460791">docs</a> - * @see AzureManagementApi#getOperationApi() - */ - @Delegate - OperationAsyncApi getOperationApi(); - - - /** - * The Service Management API includes operations for managing Disks in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157188">docs</a> - * @see AzureManagementApi#getDiskApi() - */ - @Delegate - DiskAsyncApi getDiskApi(); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementProviderMetadata.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementProviderMetadata.java b/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementProviderMetadata.java deleted file mode 100644 index 8b39ea6..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/AzureManagementProviderMetadata.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management; - -import static org.jclouds.azure.management.config.AzureManagementProperties.SUBSCRIPTION_ID; - -import java.net.URI; -import java.util.Properties; - -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.internal.BaseProviderMetadata; - -/** - * Implementation of {@link org.jclouds.types.ProviderMetadata} for Microsoft Azure Service - * Management Service. - */ -public class AzureManagementProviderMetadata extends BaseProviderMetadata { - - public static Builder builder() { - return new Builder(); - } - - @Override - public Builder toBuilder() { - return builder().fromProviderMetadata(this); - } - - public AzureManagementProviderMetadata() { - super(builder()); - } - - public AzureManagementProviderMetadata(Builder builder) { - super(builder); - } - - public static Properties defaultProperties() { - Properties properties = new Properties(); - return properties; - } - - public static class Builder extends BaseProviderMetadata.Builder { - - protected Builder() { - id("azure-management") - .name("Microsoft Azure Service Management Service") - .apiMetadata(new AzureManagementApiMetadata()) - .endpoint("https://management.core.windows.net/${" + SUBSCRIPTION_ID + "}") - .homepage(URI.create("https://www.windowsazure.com/")) - .console(URI.create("https://windows.azure.com/default.aspx")) - .linkedServices("azureblob", "azurequeue", "azuretable") - .iso3166Codes("US-TX", "US-IL", "IE-D", "SG", "NL-NH", "HK") - .defaultProperties(AzureManagementProviderMetadata.defaultProperties()); - } - - @Override - public AzureManagementProviderMetadata build() { - return new AzureManagementProviderMetadata(this); - } - - @Override - public Builder fromProviderMetadata(ProviderMetadata in) { - super.fromProviderMetadata(in); - return this; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/binders/BindCreateHostedServiceToXmlPayload.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/binders/BindCreateHostedServiceToXmlPayload.java b/azure-management/src/main/java/org/jclouds/azure/management/binders/BindCreateHostedServiceToXmlPayload.java deleted file mode 100644 index 1337101..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/binders/BindCreateHostedServiceToXmlPayload.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.binders; - -import static com.google.common.base.Charsets.UTF_8; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.io.BaseEncoding.base64; - -import java.util.Map; -import java.util.Map.Entry; - -import javax.inject.Singleton; - -import org.jclouds.azure.management.options.CreateHostedServiceOptions; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; - -import com.google.common.base.Optional; -import com.google.common.base.Throwables; -import com.jamesmurty.utils.XMLBuilder; - -@Singleton -public class BindCreateHostedServiceToXmlPayload implements MapBinder { - - private static final CreateHostedServiceOptions NO_OPTIONS = new CreateHostedServiceOptions(); - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - String serviceName = checkNotNull(postParams.get("serviceName"), "serviceName").toString(); - String label = base64().encode(checkNotNull(postParams.get("label"), "label").toString().getBytes(UTF_8)); - - Optional<String> location = Optional.fromNullable((String) postParams.get("location")); - Optional<String> affinityGroup = Optional.fromNullable((String) postParams.get("affinityGroup")); - CreateHostedServiceOptions options = Optional - .fromNullable((CreateHostedServiceOptions) postParams.get("options")).or(NO_OPTIONS); - try { - XMLBuilder createHostedService = XMLBuilder.create("CreateHostedService") - .a("xmlns", "http://schemas.microsoft.com/windowsazure").e("ServiceName").t(serviceName).up() - .e("Label").t(label).up(); - - if (options.getDescription().isPresent()) - createHostedService.e("Description").t(options.getDescription().get()).up(); - - if (location.isPresent()) - createHostedService.e("Location").t(location.get()).up(); - else if (affinityGroup.isPresent()) - createHostedService.e("AffinityGroup").t(affinityGroup.get()).up(); - else - throw new IllegalArgumentException("you must specify either Location or AffinityGroup!"); - - if (options.getExtendedProperties().isPresent() && options.getExtendedProperties().get().size() > 0) { - XMLBuilder extendedProperties = createHostedService.e("ExtendedProperties"); - for (Entry<String, String> entry : options.getExtendedProperties().get().entrySet()) - extendedProperties.e("ExtendedProperty").e("Name").t(entry.getKey()).up().e("Value").t(entry.getValue()); - } - return (R) request.toBuilder().payload(createHostedService.asString()).build(); - } catch (Exception e) { - throw Throwables.propagate(e); - } - - } - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - throw new IllegalStateException("BindCreateHostedServiceToXmlPayload is needs parameters"); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/binders/BindDeploymentParamsToXmlPayload.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/binders/BindDeploymentParamsToXmlPayload.java b/azure-management/src/main/java/org/jclouds/azure/management/binders/BindDeploymentParamsToXmlPayload.java deleted file mode 100644 index 5ad949f..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/binders/BindDeploymentParamsToXmlPayload.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.binders; - -import javax.inject.Singleton; - -import org.jclouds.azure.management.domain.DeploymentParams; -import org.jclouds.azure.management.domain.InputEndpoint; -import org.jclouds.azure.management.domain.OSType; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.google.common.base.Throwables; -import com.jamesmurty.utils.XMLBuilder; - -@Singleton -public class BindDeploymentParamsToXmlPayload implements Binder { - - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - DeploymentParams params = DeploymentParams.class.cast(input); - try { - - XMLBuilder builder = XMLBuilder.create("Deployment").a("xmlns", "http://schemas.microsoft.com/windowsazure") - .e("Name").t(params.getName()).up() - .e("DeploymentSlot").t("Production").up() - .e("Label").t(params.getName()).up() - .e("RoleList") - .e("Role") - .e("RoleName").t(params.getName()).up() - .e("RoleType").t("PersistentVMRole").up() - .e("ConfigurationSets"); - - if (params.getOsType() == OSType.WINDOWS){ - XMLBuilder configBuilder = builder.e("ConfigurationSet"); // Windows - configBuilder.e("ConfigurationSetType").t("WindowsProvisioningConfiguration").up() - .e("ComputerName").t(params.getUsername()).up() - .e("AdminPassword").t(params.getPassword()).up() - .e("ResetPasswordOnFirstLogon").t("false").up() - .e("EnableAutomaticUpdate").t("false").up() - .e("DomainJoin") - .e("Credentials") - .e("Domain").t(params.getName()).up() - .e("Username").t(params.getUsername()).up() - .e("Password").t(params.getPassword()).up() - .up()//Credentials - .e("JoinDomain").t(params.getName()).up() - .up()// Domain Join - .e("StoredCertificateSettings").up() - .up();//Windows ConfigurationSet - }else if (params.getOsType() == OSType.LINUX){ - XMLBuilder configBuilder = builder.e("ConfigurationSet"); // Linux - configBuilder.e("ConfigurationSetType").t("LinuxProvisioningConfiguration").up() - .e("HostName").t(params.getName()).up() - .e("UserName").t(params.getUsername()).up() - .e("UserPassword").t(params.getPassword()).up() - .e("DisableSshPasswordAuthentication").t("false").up() - .e("SSH").up() - .up();//Linux ConfigurationSet - } - - XMLBuilder configBuilder = builder.e("ConfigurationSet"); // Network - configBuilder.e("ConfigurationSetType").t("NetworkConfiguration").up(); - - XMLBuilder inputEndpoints = configBuilder.e("InputEndpoints"); - for (InputEndpoint endpoint : params.getEndpoints()){ - XMLBuilder inputBuilder = inputEndpoints.e("InputEndpoint"); - inputBuilder.e("LocalPort").t(endpoint.getLocalPort().toString()).up() - .e("Name").t(endpoint.getName()).up() - .e("Port").t(endpoint.getExternalPort().toString()).up() - .e("Protocol").t(endpoint.getProtocol().name()).up() - .up();//InputEndpoint - } - - inputEndpoints.up(); - configBuilder.e("SubnetNames").up() - .up(); - - builder.up()//ConfigurationSets - .e("DataVirtualHardDisks").up() - .e("OSVirtualHardDisk") - .e("HostCaching").t("ReadWrite").up() - .e("MediaLink").t("http://"+params.getStorageAccount()+".blob.core.windows.net/disks/"+params.getName()+"/"+params.getSourceImageName()).up() - .e("SourceImageName").t(params.getSourceImageName()).up() - .e("OS").t("Linux").up() - .up()//OSVirtualHardDisk - .e("RoleSize").t(params.getSize().value()).up() - .up()//Role - .up();//RoleList - - -// builder.e("ConfigurationSet") // Network -// .e("ConfigurationSetType").t("NetworkConfiguration").up() -// .e("InputEndpoints"); -// -// -// -// -// -// builder.up()//InputEndpoints -// .e("SubnetNames").up() -// .up()//Network ConfigurationSet -// .up()//ConfigurationSets -// .e("DataVirtualHardDisks").up() -// .e("OSVirtualHardDisk") -// .e("HostCaching").t("ReadWrite").up() -// .e("MediaLink").t("http://"+params.getStorageAccount()+".blob.core.windows.net/disks/"+params.getName()+"/"+params.getSourceImageName()).up() -// .e("SourceImageName").t(params.getSourceImageName()).up() -// .e("OS").t("Linux").up() -// .up()//OSVirtualHardDisk -// .e("RoleSize").t(params.getSize().name()).up() -// .up()//Role -// .up();//RoleList - - - - return (R) request.toBuilder().payload(builder.asString()).build(); - } catch (Exception e) { - throw Throwables.propagate(e); - } - - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/binders/BindOSImageParamsToXmlPayload.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/binders/BindOSImageParamsToXmlPayload.java b/azure-management/src/main/java/org/jclouds/azure/management/binders/BindOSImageParamsToXmlPayload.java deleted file mode 100644 index 060a68b..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/binders/BindOSImageParamsToXmlPayload.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.binders; - -import javax.inject.Singleton; - -import org.jclouds.azure.management.domain.OSImageParams; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.google.common.base.Throwables; -import com.jamesmurty.utils.XMLBuilder; - -@Singleton -public class BindOSImageParamsToXmlPayload implements Binder { - - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - OSImageParams params = OSImageParams.class.cast(input); - try { - return (R) request.toBuilder().payload(XMLBuilder.create("OSImage").a("xmlns", "http://schemas.microsoft.com/windowsazure") - .e("Label").t(params.getLabel()).up() - .e("MediaLink").t(params.getMediaLink().toASCIIString()).up() - .e("Name").t(params.getName()).up() - .e("OS").t(params.getOS().toString()).up() - .up().asString()).build(); - } catch (Exception e) { - throw Throwables.propagate(e); - } - - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/compute/AzureManagementComputeServiceAdapter.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/compute/AzureManagementComputeServiceAdapter.java b/azure-management/src/main/java/org/jclouds/azure/management/compute/AzureManagementComputeServiceAdapter.java deleted file mode 100644 index f2e16d9..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/compute/AzureManagementComputeServiceAdapter.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.compute; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.azure.management.AzureManagementApi; -import org.jclouds.azure.management.AzureManagementAsyncApi; -import org.jclouds.azure.management.domain.Deployment; -import org.jclouds.azure.management.domain.OSImage; -import org.jclouds.azure.management.domain.RoleSize; -import org.jclouds.compute.ComputeServiceAdapter; -import org.jclouds.compute.domain.Template; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.logging.Logger; - -/** - * defines the connection between the {@link AzureApi} implementation and the - * jclouds {@link ComputeService} - */ -@Singleton -public class AzureManagementComputeServiceAdapter implements - ComputeServiceAdapter<Deployment, RoleSize, OSImage, String> { - - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - - private final AzureManagementApi api; - private final AzureManagementAsyncApi aapi; - - @Inject - public AzureManagementComputeServiceAdapter(AzureManagementApi api, - AzureManagementAsyncApi aapi) { - this.api = checkNotNull(api, "api"); - this.aapi = checkNotNull(aapi, "aapi"); - } - - @Override - public org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials<Deployment> createNodeWithGroupEncodedIntoName( - String group, String name, Template template) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Iterable<RoleSize> listHardwareProfiles() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Iterable<OSImage> listImages() { - // TODO Auto-generated method stub - return null; - } - - @Override - public OSImage getImage(String id) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Iterable<String> listLocations() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Deployment getNode(String id) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void destroyNode(String id) { - // TODO Auto-generated method stub - - } - - @Override - public void rebootNode(String id) { - // TODO Auto-generated method stub - - } - - @Override - public void resumeNode(String id) { - // TODO Auto-generated method stub - - } - - @Override - public void suspendNode(String id) { - // TODO Auto-generated method stub - - } - - @Override - public Iterable<Deployment> listNodes() { - // TODO Auto-generated method stub - return null; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/compute/config/AzureManagementComputeServiceContextModule.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/compute/config/AzureManagementComputeServiceContextModule.java b/azure-management/src/main/java/org/jclouds/azure/management/compute/config/AzureManagementComputeServiceContextModule.java deleted file mode 100644 index 7c77ff2..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/compute/config/AzureManagementComputeServiceContextModule.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.compute.config; - -import org.jclouds.azure.management.compute.AzureManagementComputeServiceAdapter; -import org.jclouds.azure.management.compute.functions.DeploymentToNodeMetadata; -import org.jclouds.azure.management.compute.functions.OSImageToImage; -import org.jclouds.azure.management.compute.functions.RoleSizeToHardware; -import org.jclouds.azure.management.domain.Deployment; -import org.jclouds.azure.management.domain.OSImage; -import org.jclouds.azure.management.domain.RoleSize; -import org.jclouds.compute.ComputeServiceAdapter; -import org.jclouds.compute.config.ComputeServiceAdapterContextModule; -import org.jclouds.compute.domain.Hardware; -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.NodeMetadata; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class AzureManagementComputeServiceContextModule extends - ComputeServiceAdapterContextModule<Deployment, RoleSize, OSImage, String> { - - @Override - protected void configure() { - super.configure(); - bind(new TypeLiteral<ComputeServiceAdapter<Deployment, RoleSize, OSImage, String>>() { - }).to(AzureManagementComputeServiceAdapter.class); - bind(new TypeLiteral<Function<OSImage, Image>>() { - }).to(OSImageToImage.class); - bind(new TypeLiteral<Function<RoleSize, Hardware>>() { - }).to(RoleSizeToHardware.class); - bind(new TypeLiteral<Function<Deployment, NodeMetadata>>() { - }).to(DeploymentToNodeMetadata.class); - - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/DeploymentToNodeMetadata.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/DeploymentToNodeMetadata.java b/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/DeploymentToNodeMetadata.java deleted file mode 100644 index 66fe39b..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/DeploymentToNodeMetadata.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.compute.functions; - -import org.jclouds.azure.management.domain.Deployment; -import org.jclouds.compute.domain.NodeMetadata; - -import com.google.common.base.Function; - -public class DeploymentToNodeMetadata implements Function<Deployment, NodeMetadata> { - - @Override - public NodeMetadata apply(Deployment input) { - return null; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/OSImageToImage.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/OSImageToImage.java b/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/OSImageToImage.java deleted file mode 100644 index b6575e9..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/OSImageToImage.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.compute.functions; - -import org.jclouds.azure.management.domain.OSImage; -import org.jclouds.compute.domain.Image; - -import com.google.common.base.Function; - -public class OSImageToImage implements Function<OSImage, Image>{ - - @Override - public Image apply(OSImage input) { - return null; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/RoleSizeToHardware.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/RoleSizeToHardware.java b/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/RoleSizeToHardware.java deleted file mode 100644 index 00ce385..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/compute/functions/RoleSizeToHardware.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.compute.functions; - -import org.jclouds.azure.management.domain.RoleSize; -import org.jclouds.compute.domain.Hardware; - -import com.google.common.base.Function; - -public class RoleSizeToHardware implements Function<RoleSize, Hardware> { - - @Override - public Hardware apply(RoleSize input) { - return null; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementProperties.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementProperties.java b/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementProperties.java deleted file mode 100644 index d543455..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementProperties.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.config; - -/** - * Configuration properties and constants used in Azure Service Management - * connections. - */ -public class AzureManagementProperties { - /** - * Every call to the Service Management API must include the subscription ID - * for your subscription. The subscription ID is appended to the base URI, - * as follows: - * - * <pre> - * https://management.core.windows.net/${subscriptionId} - * </pre> - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460786">docs</a> - */ - public static final String SUBSCRIPTION_ID = "jclouds.azure.management.subscription-id"; -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementRestClientModule.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementRestClientModule.java b/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementRestClientModule.java deleted file mode 100644 index 7e7a351..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/config/AzureManagementRestClientModule.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.config; - -import java.security.KeyStore; -import java.util.Map; - -import javax.net.ssl.SSLContext; - -import org.jclouds.azure.management.AzureManagementApi; -import org.jclouds.azure.management.AzureManagementAsyncApi; -import org.jclouds.azure.management.features.DiskApi; -import org.jclouds.azure.management.features.DiskAsyncApi; -import org.jclouds.azure.management.features.HostedServiceApi; -import org.jclouds.azure.management.features.HostedServiceAsyncApi; -import org.jclouds.azure.management.features.LocationApi; -import org.jclouds.azure.management.features.LocationAsyncApi; -import org.jclouds.azure.management.features.OSImageApi; -import org.jclouds.azure.management.features.OSImageAsyncApi; -import org.jclouds.azure.management.features.OperationApi; -import org.jclouds.azure.management.features.OperationAsyncApi; -import org.jclouds.azure.management.features.RoleApi; -import org.jclouds.azure.management.features.RoleAsyncApi; -import org.jclouds.azure.management.suppliers.KeyStoreSupplier; -import org.jclouds.azure.management.suppliers.SSLContextWithKeysSupplier; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; - -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMap; -import com.google.inject.TypeLiteral; - -/** - * Configures the Azure Service Management connection. - */ -@ConfiguresRestClient -public class AzureManagementRestClientModule extends RestClientModule<AzureManagementApi, AzureManagementAsyncApi> { - public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder() - .put(LocationApi.class, LocationAsyncApi.class) - .put(RoleApi.class, RoleAsyncApi.class) - .put(HostedServiceApi.class, HostedServiceAsyncApi.class) - .put(OSImageApi.class, OSImageAsyncApi.class) - .put(OperationApi.class, OperationAsyncApi.class) - .put(DiskApi.class, DiskAsyncApi.class).build(); - - public AzureManagementRestClientModule() { - super(DELEGATE_MAP); - } - - @Override - protected void configure() { - super.configure(); - bind(new TypeLiteral<Supplier<SSLContext>>() { - }).to(new TypeLiteral<SSLContextWithKeysSupplier>() { - }); - bind(new TypeLiteral<Supplier<KeyStore>>() { - }).to(new TypeLiteral<KeyStoreSupplier>() { - }); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/domain/Deployment.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/domain/Deployment.java b/azure-management/src/main/java/org/jclouds/azure/management/domain/Deployment.java deleted file mode 100644 index 9b800e0..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/domain/Deployment.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.domain; - -import java.net.URI; - -public class Deployment { - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String deploymentName; - private DeploymentSlot deploymentSlot; - private DeploymentStatus deploymentStatus; - private String deploymentLabel; - private URI deploymentURL; - private String roleName; - private String instanceName; - private InstanceStatus instanceStatus; - private String instanceStateDetails; - private String instanceErrorCode; - private RoleSize instanceSize; - private String privateIpAddress; - private String publicIpAddress; - - public Builder deploymentName(final String deploymentName) { - this.deploymentName = deploymentName; - return this; - } - - public Builder deploymentSlot(final DeploymentSlot deploymentSlot) { - this.deploymentSlot = deploymentSlot; - return this; - } - - public Builder deploymentStatus(final DeploymentStatus deploymentStatus) { - this.deploymentStatus = deploymentStatus; - return this; - } - - public Builder deploymentLabel(final String deploymentLabel) { - this.deploymentLabel = deploymentLabel; - return this; - } - - public Builder deploymentURL(final URI deploymentURL) { - this.deploymentURL = deploymentURL; - return this; - } - - public Builder instanceSize(final RoleSize instanceSize) { - this.instanceSize = instanceSize; - return this; - } - - public Builder instanceName(final String instanceName) { - this.instanceName = instanceName; - return this; - } - - public Builder instanceStatus(final InstanceStatus instanceStatus) { - this.instanceStatus = instanceStatus; - return this; - } - - public Builder instanceStateDetails(final String instanceStateDetails) { - this.instanceStateDetails = instanceStateDetails; - return this; - } - - public Builder instanceErrorCode(final String instanceErrorCode) { - this.instanceErrorCode = instanceErrorCode; - return this; - } - - public Builder privateIpAddress(final String privateIpAddress) { - this.privateIpAddress = privateIpAddress; - return this; - } - - public Builder publicIpAddress(final String publicIpAddress) { - this.publicIpAddress = publicIpAddress; - return this; - } - - public Builder roleName(final String roleName) { - this.roleName = roleName; - return this; - } - - public Deployment build() { - return new Deployment(deploymentName, deploymentSlot, - deploymentStatus, deploymentLabel, deploymentURL, roleName, - instanceName, instanceStatus,instanceStateDetails,instanceErrorCode, instanceSize, - privateIpAddress, publicIpAddress); - } - - } - - /** - * The user-supplied name for this deployment. - */ - private final String deploymentName; - /** - * The environment to which the hosted service is deployed, either staging - * or production. - */ - private final DeploymentSlot deploymentSlot; - /** - * The status of the deployment. - */ - private final DeploymentStatus deploymentStatus; - /** - * The user-supplied name of the deployment returned as a base-64 encoded - * string. This name can be used identify the deployment for your tracking - * purposes. - */ - private final String deploymentLabel; - /** - * The URL used to access the hosted service. For example, if the service - * name is MyService you could access the access the service by calling: - * http://MyService.cloudapp.net - */ - private final URI deploymentURL; - - /** - * Specifies the name for the virtual machine. The name must be unique - * within Windows Azure. - */ - private final String roleName; - - /** - * The name of the specific role instance (if any). - */ - private final String instanceName; - /** - * The current status of this instance. - */ - private final InstanceStatus instanceStatus; - /** - * The instance state is returned as an English human-readable string that, - * when present, provides a snapshot of the state of the virtual machine at - * the time the operation was called. - * - * For example, when the instance is first being initialized a - * "Preparing Windows for first use." could be returned. - */ - private final String instanceStateDetails; - /** - * Error code of the latest role or VM start - * - * For VMRoles the error codes are: - * - * WaitTimeout - The virtual machine did not communicate back to Azure - * infrastructure within 25 minutes. Typically this indicates that the - * virtual machine did not start or that the guest agent is not installed. - * - * VhdTooLarge - The VHD image selected was too large for the virtual - * machine hosting the role. - * - * AzureInternalError â An internal error has occurred that has caused to - * virtual machine to fail to start. Contact support for additional - * assistance. - * - * For web and worker roles this field returns an error code that can be provided to Windows Azure support to assist in resolution of errors. Typically this field will be empty. - */ - private final String instanceErrorCode; - - /** - * The size of the role instance - */ - private final RoleSize instanceSize; - private final String privateIpAddress; - private final String publicIpAddress; - - public Deployment(String deploymentName, DeploymentSlot deploymentSlot, - DeploymentStatus deploymentStatus, String deploymentLabel, - URI deploymentURL, String roleName, String instanceName, - InstanceStatus instanceStatus,String instanceStateDetails, String instanceErrorCode, RoleSize instanceSize, - String privateIpAddress, String publicIpAddress) { - super(); - this.deploymentName = deploymentName; - this.deploymentSlot = deploymentSlot; - this.deploymentStatus = deploymentStatus; - this.deploymentLabel = deploymentLabel; - this.deploymentURL = deploymentURL; - this.roleName = roleName; - this.instanceName = instanceName; - this.instanceStatus = instanceStatus; - this.instanceStateDetails = instanceStateDetails; - this.instanceErrorCode = instanceErrorCode; - this.instanceSize = instanceSize; - this.privateIpAddress = privateIpAddress; - this.publicIpAddress = publicIpAddress; - } - - public String getDeploymentName() { - return deploymentName; - } - - public DeploymentSlot getDeploymentSlot() { - return deploymentSlot; - } - - public DeploymentStatus getDeploymentStatus() { - return deploymentStatus; - } - - public String getDeploymentLabel() { - return deploymentLabel; - } - - public URI getDeploymentURL() { - return deploymentURL; - } - - public String getRoleName() { - return roleName; - } - - public String getInstanceName() { - return instanceName; - } - - public InstanceStatus getInstanceStatus() { - return instanceStatus; - } - - public String getInstanceStateDetails() { - return instanceStateDetails; - } - - public String getInstanceErrorCode() { - return instanceErrorCode; - } - - public RoleSize getInstanceSize() { - return instanceSize; - } - - public String getPrivateIpAddress() { - return privateIpAddress; - } - - public String getPublicIpAddress() { - return publicIpAddress; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((deploymentName == null) ? 0 : deploymentName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Deployment other = (Deployment) obj; - if (deploymentName == null) { - if (other.deploymentName != null) - return false; - } else if (!deploymentName.equals(other.deploymentName)) - return false; - return true; - } - - @Override - public String toString() { - return "Deployment [deploymentName=" + deploymentName - + ", deploymentSlot=" + deploymentSlot + ", deploymentStatus=" - + deploymentStatus + ", deploymentLabel=" + deploymentLabel - + ", deploymentURL=" + deploymentURL + ", roleName=" + roleName - + ", instanceName=" + instanceName + ", instanceStatus=" - + instanceStatus + ", instanceStateDetails=" - + instanceStateDetails + ", instanceErrorCode=" - + instanceErrorCode + ", instanceSize=" + instanceSize - + ", privateIpAddress=" + privateIpAddress - + ", publicIpAddress=" + publicIpAddress + "]"; - } - - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java b/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java deleted file mode 100644 index dc51c38..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentParams.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.domain; - -import java.util.List; - -import com.google.common.base.MoreObjects; -import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.base.Objects; -import com.google.common.collect.Lists; - -/** - * - * To create a new deployment/role - * - * Warning : the OSType must be the one of the source image used to create the VM - */ -public class DeploymentParams { - - public static Builder builder() { - return new Builder(); - } - - public Builder toBuilder() { - return builder().fromLinuxDeploymentParams(this); - } - - public static class Builder { - - protected String name; - protected String sourceImageName; - protected String username; - protected String password; - protected String storageAccount; - protected OSType osType; - protected RoleSize size = RoleSize.SMALL; - protected List<InputEndpoint> endpoints = Lists.newArrayList(); - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder sourceImageName(String sourceImageName) { - this.sourceImageName = sourceImageName; - return this; - } - - public Builder username(String username) { - this.username = username; - return this; - } - - public Builder password(String password) { - this.password = password; - return this; - } - - public Builder storageAccount(String storageAccount) { - this.storageAccount = storageAccount; - return this; - } - - public Builder size(RoleSize size) { - this.size = size; - return this; - } - - public Builder osType(OSType osType) { - this.osType = osType; - return this; - } - - public Builder endpoint(InputEndpoint endpoint) { - endpoints.add(endpoint); - return this; - } - - public DeploymentParams build() { - return new DeploymentParams(name, sourceImageName, - username, password, storageAccount, size,osType,endpoints); - } - - public Builder fromLinuxDeploymentParams(DeploymentParams in) { - // TODO Since the roleName should be unique, is it a good idea to - // copy it ? - return this.name(in.getName()) - .sourceImageName(in.getSourceImageName()) - .username(in.getUsername()).password(in.getPassword()) - .size(in.getSize()); - } - } - - protected final String name; - protected final String sourceImageName; - protected final String username; - protected final String password; - protected final String storageAccount; - protected final RoleSize size; - protected final OSType osType; - protected final List<InputEndpoint> endpoints; - - - public DeploymentParams(String name, String sourceImageName, - String username, String password, String storageAccount, - RoleSize size,OSType osType,final List<InputEndpoint> endpoints) { - super(); - this.name = name; - this.sourceImageName = sourceImageName; - this.username = username; - this.password = password; - this.storageAccount = storageAccount; - this.size = size; - this.osType = osType; - this.endpoints = endpoints; - } - - /** - * Specifies the name for the deployment and its virtual machine. The name must be unique - * within Windows Azure. - */ - public String getName() { - return name; - } - - /** - * Specifies the name of an operating system image in the image repository. - */ - public String getSourceImageName() { - return sourceImageName; - } - - /** - * Specifies the name of a user to be created in the sudoer group of the - * virtual machine. User names are ASCII character strings 1 to 32 - * characters in length. - */ - public String getUsername() { - return username; - } - - /** - * Specifies the associated password for the user name. - * PasswoazureManagement are ASCII character strings 6 to 72 characters in - * length. - */ - public String getPassword() { - return password; - } - - public String getStorageAccount() { - return storageAccount; - } - - /** - * The size of the virtual machine to allocate. The default value is Small. - */ - public RoleSize getSize() { - return size; - } - - /** - * Os type of the given sourceImage - */ - public OSType getOsType() { - return osType; - } - - public List<InputEndpoint> getEndpoints() { - return endpoints; - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return Objects.hashCode(name); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - DeploymentParams other = (DeploymentParams) obj; - return Objects.equal(this.name, other.name); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return string().toString(); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this).add("name", name) - .add("sourceImageName", sourceImageName).add("size", size); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentSlot.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentSlot.java b/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentSlot.java deleted file mode 100644 index 93a207e..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/domain/DeploymentSlot.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.CaseFormat; - -public enum DeploymentSlot { - PRODUCTION,STAGING; - - public String value() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); - } - - @Override - public String toString() { - return value(); - } - - public static DeploymentSlot fromValue(String type) { - try { - return valueOf(CaseFormat.UPPER_CAMEL.to( - CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type"))); - } catch (IllegalArgumentException e) { - return null; - } - } -}
