Remove deprecated Azure provider
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/b8ab3758 Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/b8ab3758 Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/b8ab3758 Branch: refs/heads/2.1.x Commit: b8ab3758d9e9c5409c391f147d4654e7b5bfca94 Parents: f2c637b Author: Ignasi Barrera <[email protected]> Authored: Mon Oct 15 13:24:03 2018 +0200 Committer: Ignasi Barrera <[email protected]> Committed: Mon Oct 15 18:26:04 2018 +0200 ---------------------------------------------------------------------- azurecompute/.gitignore | 9 - azurecompute/README.md | 26 - azurecompute/pom.xml | 157 ------ .../jclouds/azurecompute/AzureComputeApi.java | 176 ------ .../AzureComputeProviderMetadata.java | 92 ---- .../AzureManagementApiMetadata.java | 89 --- .../binders/CaptureVMImageParamsToXML.java | 68 --- .../binders/CreateAffinityGroupParamsToXML.java | 50 -- .../CreateStorageServiceParamsToXML.java | 76 --- .../binders/DeploymentParamsToXML.java | 141 ----- .../binders/NetworkConfigurationToXML.java | 70 --- .../binders/NetworkSecurityGroupToXML.java | 47 -- .../binders/OSImageParamsToXML.java | 46 -- .../binders/ProfileDefinitionParamsToXML.java | 79 --- .../binders/ProfileParamsToXML.java | 51 -- .../binders/ReservedIPAddressParamsToXML.java | 48 -- .../jclouds/azurecompute/binders/RoleToXML.java | 87 --- .../jclouds/azurecompute/binders/RuleToXML.java | 48 -- .../binders/ServiceCertificateParamsToXML.java | 47 -- .../binders/StorageServiceKeyTypeToXML.java | 43 -- .../binders/UpdateAffinityGroupParamsToXML.java | 50 -- .../UpdateStorageServiceParamsToXML.java | 86 --- .../binders/VMImageParamsToXML.java | 97 ---- .../compute/AzureComputeServiceAdapter.java | 536 ------------------- .../AzureComputeServiceContextModule.java | 155 ------ .../AzureComputeSecurityGroupExtension.java | 392 -------------- .../functions/DeploymentToNodeMetadata.java | 183 ------- .../compute/functions/LocationToLocation.java | 63 --- .../compute/functions/OSImageToImage.java | 154 ------ .../compute/functions/RoleSizeToHardware.java | 48 -- .../functions/internal/OperatingSystems.java | 95 ---- .../options/AzureComputeTemplateOptions.java | 443 --------------- .../predicates/StorageServicePredicates.java | 80 --- ...ServiceAndVirtualNetworkThenCreateNodes.java | 190 ------- ...eNodeCredentialsButOverrideFromTemplate.java | 61 --- .../config/AzureComputeHttpApiModule.java | 64 --- .../config/AzureComputeParserModule.java | 29 - .../config/AzureComputeProperties.java | 36 -- .../azurecompute/domain/AffinityGroup.java | 104 ---- .../azurecompute/domain/Availability.java | 38 -- .../domain/CaptureVMImageParams.java | 117 ---- .../azurecompute/domain/CloudService.java | 117 ---- .../domain/CloudServiceProperties.java | 96 ---- .../domain/ComputeCapabilities.java | 56 -- .../domain/CreateAffinityGroupParams.java | 115 ---- .../domain/CreateProfileParams.java | 91 ---- .../domain/CreateStorageServiceParams.java | 161 ------ .../domain/DataVirtualHardDisk.java | 108 ---- .../jclouds/azurecompute/domain/Deployment.java | 315 ----------- .../azurecompute/domain/DeploymentParams.java | 194 ------- .../org/jclouds/azurecompute/domain/Disk.java | 128 ----- .../org/jclouds/azurecompute/domain/Error.java | 71 --- .../jclouds/azurecompute/domain/Location.java | 61 --- .../domain/NetworkConfiguration.java | 117 ---- .../domain/NetworkSecurityGroup.java | 81 --- .../jclouds/azurecompute/domain/OSImage.java | 119 ---- .../azurecompute/domain/OSImageParams.java | 107 ---- .../jclouds/azurecompute/domain/Operation.java | 72 --- .../jclouds/azurecompute/domain/Profile.java | 81 --- .../azurecompute/domain/ProfileDefinition.java | 199 ------- .../domain/ProfileDefinitionEndpoint.java | 148 ----- .../domain/ProfileDefinitionEndpointParams.java | 180 ------- .../domain/ProfileDefinitionMonitor.java | 121 ----- .../domain/ProfileDefinitionParams.java | 161 ------ .../org/jclouds/azurecompute/domain/Region.java | 90 ---- .../azurecompute/domain/ReservedIPAddress.java | 152 ------ .../domain/ReservedIPAddressParams.java | 104 ---- .../org/jclouds/azurecompute/domain/Role.java | 310 ----------- .../jclouds/azurecompute/domain/RoleSize.java | 161 ------ .../org/jclouds/azurecompute/domain/Rule.java | 146 ----- .../azurecompute/domain/ServiceCertificate.java | 74 --- .../domain/ServiceCertificateParams.java | 100 ---- .../azurecompute/domain/StorageService.java | 243 --------- .../azurecompute/domain/StorageServiceKeys.java | 54 -- .../domain/UpdateAffinityGroupParams.java | 84 --- .../domain/UpdateProfileParams.java | 86 --- .../domain/UpdateStorageServiceParams.java | 190 ------- .../jclouds/azurecompute/domain/VMImage.java | 166 ------ .../azurecompute/domain/VMImageParams.java | 246 --------- .../azurecompute/features/AffinityGroupApi.java | 122 ----- .../azurecompute/features/CloudServiceApi.java | 151 ------ .../azurecompute/features/DeploymentApi.java | 76 --- .../jclouds/azurecompute/features/DiskApi.java | 71 --- .../azurecompute/features/LocationApi.java | 54 -- .../features/NetworkSecurityGroupApi.java | 215 -------- .../azurecompute/features/OSImageApi.java | 98 ---- .../azurecompute/features/OperationApi.java | 48 -- .../features/ReservedIPAddressApi.java | 107 ---- .../features/ServiceCertificatesApi.java | 123 ----- .../features/StorageAccountApi.java | 140 ----- .../azurecompute/features/SubscriptionApi.java | 53 -- .../features/TrafficManagerApi.java | 184 ------- .../azurecompute/features/VMImageApi.java | 95 ---- .../features/VirtualMachineApi.java | 152 ------ .../features/VirtualNetworkApi.java | 75 --- .../functions/Base64EncodeLabel.java | 30 -- .../functions/OSImageParamsName.java | 29 - .../functions/ParseRequestIdHeader.java | 46 -- .../handlers/AzureComputeErrorHandler.java | 83 --- .../suppliers/DelegatingSSLContextSupplier.java | 92 ---- .../suppliers/FileBasedKeyManagersSupplier.java | 64 --- .../suppliers/InMemoryKeyManagersSupplier.java | 138 ----- .../util/ConflictManagementPredicate.java | 211 -------- .../util/NetworkSecurityGroups.java | 72 --- .../azurecompute/xml/AddressSpaceHandler.java | 59 -- .../azurecompute/xml/AffinityGroupHandler.java | 136 ----- .../azurecompute/xml/AttachmentHandler.java | 60 --- .../azurecompute/xml/AvailabilityHandler.java | 54 -- .../azurecompute/xml/CloudServiceHandler.java | 134 ----- .../xml/CloudServicePropertiesHandler.java | 157 ------ .../xml/ComputeCapabilitiesHandler.java | 87 --- .../xml/ConfigurationSetHandler.java | 124 ----- .../xml/DataVirtualHardDiskHandler.java | 92 ---- .../azurecompute/xml/DeploymentHandler.java | 163 ------ .../jclouds/azurecompute/xml/DiskHandler.java | 125 ----- .../jclouds/azurecompute/xml/ErrorHandler.java | 58 -- .../xml/ExtendedPropertiesHandler.java | 55 -- .../azurecompute/xml/InputEndpointHandler.java | 96 ---- .../xml/InstanceEndpointHandler.java | 81 --- .../xml/ListAffinityGroupsHandler.java | 76 --- .../xml/ListCloudServicesHandler.java | 77 --- .../xml/ListDataVirtualHardDisksHandler.java | 70 --- .../azurecompute/xml/ListDisksHandler.java | 73 --- .../azurecompute/xml/ListLocationsHandler.java | 70 --- .../xml/ListNetworkSecurityGroupsHandler.java | 70 --- .../azurecompute/xml/ListOSImagesHandler.java | 70 --- .../xml/ListProfileDefinitionsHandler.java | 79 --- .../azurecompute/xml/ListProfilesHandler.java | 79 --- .../xml/ListReservedIPAddressHandler.java | 78 --- .../azurecompute/xml/ListRoleSizesHandler.java | 69 --- .../xml/ListServiceCertificatesHandler.java | 78 --- .../xml/ListStorageServicesHandler.java | 72 --- .../azurecompute/xml/ListVMImagesHandler.java | 70 --- .../xml/ListVirtualNetworkSitesHandler.java | 72 --- .../azurecompute/xml/LocationHandler.java | 107 ---- .../xml/NetworkConfigurationHandler.java | 74 --- .../xml/NetworkSecurityGroupHandler.java | 91 ---- .../azurecompute/xml/OSConfigHandler.java | 106 ---- .../azurecompute/xml/OSImageHandler.java | 188 ------- .../xml/OSVirtualHardDiskHandler.java | 76 --- .../azurecompute/xml/OperationHandler.java | 86 --- .../xml/ProfileDefinitionEndpointHandler.java | 110 ---- .../xml/ProfileDefinitionHandler.java | 148 ----- .../xml/ProfileDefinitionMonitorHandler.java | 114 ---- .../azurecompute/xml/ProfileHandler.java | 113 ---- .../xml/ReservedIPAddressHandler.java | 103 ---- .../ResourceExtensionParameterValueHandler.java | 67 --- .../xml/ResourceExtensionReferenceHandler.java | 107 ---- .../jclouds/azurecompute/xml/ResultHandler.java | 64 --- .../jclouds/azurecompute/xml/RoleHandler.java | 193 ------- .../azurecompute/xml/RoleInstanceHandler.java | 136 ----- .../azurecompute/xml/RoleSizeHandler.java | 106 ---- .../jclouds/azurecompute/xml/RuleHandler.java | 99 ---- .../xml/ServiceCertificateHandler.java | 80 --- .../azurecompute/xml/StorageServiceHandler.java | 129 ----- .../xml/StorageServiceKeysHandler.java | 70 --- .../xml/StorageServicePropertiesHandler.java | 175 ------ .../jclouds/azurecompute/xml/SubnetHandler.java | 70 --- .../azurecompute/xml/SubnetNameHandler.java | 59 -- .../azurecompute/xml/VMImageHandler.java | 207 ------- .../azurecompute/xml/VirtualIPHandler.java | 71 --- .../xml/VirtualNetworkConfigurationHandler.java | 78 --- .../xml/VirtualNetworkSiteHandler.java | 118 ---- .../AzureComputeProviderMetadataTest.java | 28 - .../jclouds/azurecompute/AzureTestUtils.java | 52 -- .../binders/DeploymentParamsToXMLTest.java | 64 --- .../AzureComputeServiceContextLiveTest.java | 127 ----- .../compute/AzureComputeServiceLiveTest.java | 63 --- .../compute/AzureTemplateBuilderLiveTest.java | 49 -- ...reComputeSecurityGroupExtensionLiveTest.java | 82 --- .../compute/functions/OSImageToImageTest.java | 266 --------- .../features/AffinityGroupApiLiveTest.java | 97 ---- .../features/AffinityGroupApiMockTest.java | 161 ------ .../features/CloudServiceApiLiveTest.java | 146 ----- .../features/CloudServiceApiMockTest.java | 169 ------ .../features/DeploymentApiLiveTest.java | 187 ------- .../features/DeploymentApiMockTest.java | 121 ----- .../azurecompute/features/DiskApiLiveTest.java | 113 ---- .../azurecompute/features/DiskApiMockTest.java | 60 --- .../features/LocationApiLiveTest.java | 54 -- .../features/LocationApiMockTest.java | 45 -- .../NetworkSecurityGroupApiLiveTest.java | 215 -------- .../NetworkSecurityGroupApiMockTest.java | 277 ---------- .../features/OSImageApiLiveTest.java | 84 --- .../features/OSImageApiMockTest.java | 99 ---- .../features/OperationApiMockTest.java | 43 -- .../features/ReservedIPAddressApiLiveTest.java | 92 ---- .../features/ReservedIPAddressApiMockTest.java | 131 ----- .../ServiceCertificatesApiLiveTest.java | 117 ---- .../ServiceCertificatesApiMockTest.java | 151 ------ .../features/StorageAccountApiLiveTest.java | 118 ---- .../features/StorageAccountApiMockTest.java | 228 -------- .../features/SubscriptionApiLiveTest.java | 44 -- .../features/SubscriptionApiMockTest.java | 60 --- .../features/TrafficManagerApiLiveTest.java | 181 ------- .../features/TrafficManagerApiMockTest.java | 258 --------- .../features/VMImageApiLiveTest.java | 218 -------- .../features/VMImageApiMockTest.java | 198 ------- .../features/VirtualMachineApiLiveTest.java | 222 -------- .../features/VirtualMachineApiMockTest.java | 133 ----- .../features/VirtualNetworkApiLiveTest.java | 114 ---- .../features/VirtualNetworkApiMockTest.java | 94 ---- .../AbstractAzureComputeApiLiveTest.java | 64 --- .../internal/BaseAzureComputeApiLiveTest.java | 203 ------- .../internal/BaseAzureComputeApiMockTest.java | 102 ---- .../xml/CloudServiceHandlerTest.java | 56 -- .../xml/CloudServicePropertiesHandlerTest.java | 147 ----- .../azurecompute/xml/DeploymentHandlerTest.java | 153 ------ .../azurecompute/xml/ErrorHandlerTest.java | 42 -- .../xml/ListAffinityGroupsHandlerTest.java | 90 ---- .../xml/ListCloudServicesHandlerTest.java | 72 --- .../ListDataVirtualHardDisksHandlerTest.java | 60 --- .../azurecompute/xml/ListDisksHandlerTest.java | 67 --- .../xml/ListLocationsHandlerTest.java | 53 -- .../ListNetworkSecurityGroupsHandlerTest.java | 47 -- .../xml/ListOSImagesHandlerTest.java | 178 ------ .../xml/ListProfileDefinitionsHandlerTest.java | 75 --- .../xml/ListProfilesHandlerTest.java | 58 -- .../xml/ListReservedIPAddressHandlerTest.java | 65 --- .../xml/ListRoleSizesHandlerTest.java | 64 --- .../ListServiceCertificatessHandlerTest.java | 90 ---- .../xml/ListStorageServiceHandlerTest.java | 79 --- .../xml/ListVMImagesHandlerTest.java | 106 ---- .../xml/ListVirtualNetworkSitesHandlerTest.java | 59 -- .../xml/NetworkConfigurationHandlerTest.java | 50 -- .../xml/NetworkSecurityGroupHandlerTest.java | 153 ------ .../azurecompute/xml/OperationHandlerTest.java | 41 -- .../xml/ProfileDefinitionHandlerTest.java | 71 --- .../azurecompute/xml/ProfileHandlerTest.java | 47 -- .../xml/ReservedIPAddressHandlerTest.java | 47 -- .../azurecompute/xml/RoleHandlerTest.java | 123 ----- .../xml/ServiceCertificateHandlerTest.java | 55 -- .../src/test/resources/affinityGroup.xml | 22 - .../src/test/resources/affinityGroups.xml | 45 -- azurecompute/src/test/resources/azure-test.p12 | Bin 1536 -> 0 bytes .../src/test/resources/capturerolepayload.xml | 1 - .../resources/checkdnsprefixavailability.xml | 4 - .../test/resources/cloudserviceproperties.xml | 120 ----- .../resources/create_hostedservice_location.xml | 1 - .../resources/createaffinitygroupparams.xml | 1 - .../src/test/resources/createprofileparams.xml | 1 - .../resources/createstorageserviceparams.xml | 1 - .../src/test/resources/datavirtualharddisk.xml | 18 - azurecompute/src/test/resources/deployment.xml | 97 ---- .../test/resources/deploymentparams-windows.xml | 1 - .../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 | 13 - .../src/test/resources/hostedservices.xml | 29 - azurecompute/src/test/resources/imageparams.xml | 1 - azurecompute/src/test/resources/images.xml | 98 ---- .../resources/isavailablestorageservice.xml | 1 - .../test/resources/listprofiledefinitions.xml | 44 -- .../src/test/resources/listprofiles.xml | 23 - .../test/resources/listreservedipaddress.xml | 20 - azurecompute/src/test/resources/locations.xml | 57 -- .../src/test/resources/logback-test.xml | 34 -- .../src/test/resources/networkconfiguration.xml | 18 - .../src/test/resources/networksecuritygroup.xml | 5 - .../resources/networksecuritygroupforsubnet.xml | 4 - .../networksecuritygroupfulldetails.xml | 97 ---- .../test/resources/networksecuritygroups.xml | 12 - azurecompute/src/test/resources/operation.xml | 10 - azurecompute/src/test/resources/profile.xml | 15 - .../src/test/resources/profiledefinition.xml | 42 -- .../resources/profiledefinitioncsparams.xml | 1 - .../resources/profiledefinitiontmparams.xml | 35 -- .../src/test/resources/reservedipaddress.xml | 10 - .../test/resources/reservedipaddressparams.xml | 1 - .../src/test/resources/restartrolepayload.xml | 1 - .../src/test/resources/role-update-body.xml | 37 -- azurecompute/src/test/resources/role.xml | 56 -- azurecompute/src/test/resources/role2.xml | 34 -- azurecompute/src/test/resources/rolesizes.xml | 25 - .../src/test/resources/servicecertificate.xml | 4 - .../test/resources/servicecertificateparams.xml | 1 - .../src/test/resources/servicecertificates.xml | 14 - .../src/test/resources/shutdownrolepayload.xml | 1 - .../src/test/resources/startrolepayload.xml | 1 - .../src/test/resources/storageaccountkeys.xml | 1 - .../resources/storageaccountregeneratekeys.xml | 1 - .../src/test/resources/storageservices.xml | 34 -- .../resources/updateaffinitygroupparams.xml | 1 - .../src/test/resources/updateprofileparams.xml | 1 - .../resources/updatestorageserviceparams.xml | 1 - azurecompute/src/test/resources/virtualIPs.xml | 7 - .../src/test/resources/virtualnetworksites.xml | 36 -- .../src/test/resources/vmimageparams.xml | 1 - .../src/test/resources/vmimageparams_mock.xml | 1 - azurecompute/src/test/resources/vmimages.xml | 56 -- pom.xml | 1 - 292 files changed, 26538 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/.gitignore ---------------------------------------------------------------------- diff --git a/azurecompute/.gitignore b/azurecompute/.gitignore deleted file mode 100644 index 8fb7bef..0000000 --- a/azurecompute/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# use glob syntax. -syntax: glob -target -.settings -.classpath -.project -jclouds-azurecompute.iml -jclouds-azurecompute.ipr -jclouds-azurecompute.iws http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/README.md ---------------------------------------------------------------------- diff --git a/azurecompute/README.md b/azurecompute/README.md deleted file mode 100644 index 7d251d7..0000000 --- a/azurecompute/README.md +++ /dev/null @@ -1,26 +0,0 @@ -## Annotation processing -In order for value object and service loader auto-generation, you will need to enable annotation processing in your IDE. -If you notice any inconsistencies in your IDE after you enable annotation processing, try rerunning "Make Project". - -## Setting up test credentials - -Azure requests are signed by via SSL certificate. You need to upload one into your account in order to run tests. - -```bash -# create the certificate request -mkdir -m 700 $HOME/.jclouds -openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout $HOME/.jclouds/azure.pem -out $HOME/.jclouds/azure.pem -# create the p12 file, and note your export password. This will be your test credentials. -openssl pkcs12 -export -out $HOME/.jclouds/azure.p12 -in $HOME/.jclouds/azure.pem -name "jclouds :: $USER" -# create a cer file which you upload to the management console to authorize this certificate. -# https://manage.windowsazure.com/@ignasibarreragmail.onmicrosoft.com#Workspaces/AdminTasks/ListManagementCertificates -# note you need to press command+shift+. to display hidden directories in a open dialog in osx -openssl x509 -inform pem -in $HOME/.jclouds/azure.pem -outform der -out $HOME/.jclouds/azure.cer -``` - -Once you do this, you will set the following to run the live tests. -```bash -mvn -Plive -Dtest.azurecompute.endpoint=https://management.core.windows.net/12345678-abcd-dcba-abdc-ba0987654321 \ --Dtest.azurecompute.credential=P12_EXPORT_PASSWORD \ --Dtest.azurecompute.identity=$HOME/.jclouds/azure.p12 -``` \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/pom.xml ---------------------------------------------------------------------- diff --git a/azurecompute/pom.xml b/azurecompute/pom.xml deleted file mode 100644 index e472fa8..0000000 --- a/azurecompute/pom.xml +++ /dev/null @@ -1,157 +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/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.jclouds.labs</groupId> - <artifactId>jclouds-labs</artifactId> - <version>2.1.2-SNAPSHOT</version> - </parent> - - <!-- TODO: when out of labs, switch to org.jclouds.provider --> - <artifactId>azurecompute</artifactId> - <name>jclouds azure compute API</name> - <description>jclouds components to access an implementation of Azure's Compute Service</description> - <packaging>bundle</packaging> - - <properties> - <test.jclouds.azurecompute.subscription-id>FIXME_subscription-id</test.jclouds.azurecompute.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.azurecompute.endpoint>https://management.core.windows.net/${test.jclouds.azurecompute.subscription-id}</test.azurecompute.endpoint> - <test.azurecompute.api-version>2014-10-01</test.azurecompute.api-version> - <test.azurecompute.build-version /> - <test.azurecompute.identity>/path/to/cert.p12</test.azurecompute.identity> - <test.azurecompute.credential>password to cert</test.azurecompute.credential> - <jclouds.osgi.export>org.jclouds.azurecompute*;version="${project.version}"</jclouds.osgi.export> - <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import> - </properties> - - <dependencies> - <dependency> - <groupId>com.jamesmurty.utils</groupId> - <artifactId>java-xmlbuilder</artifactId> - </dependency> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-compute</artifactId> - <version>${project.parent.version}</version> - </dependency> - <dependency> - <groupId>com.google.auto.service</groupId> - <artifactId>auto-service</artifactId> - <scope>provided</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>com.google.auto.value</groupId> - <artifactId>auto-value</artifactId> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-core</artifactId> - <version>${project.parent.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-compute</artifactId> - <version>${project.parent.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.jclouds.driver</groupId> - <artifactId>jclouds-slf4j</artifactId> - <version>${project.parent.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.jclouds.driver</groupId> - <artifactId>jclouds-slf4j</artifactId> - <version>${project.parent.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.jclouds.driver</groupId> - <artifactId>jclouds-sshj</artifactId> - <version>${project.parent.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.squareup.okhttp</groupId> - <artifactId>mockwebserver</artifactId> - <scope>test</scope> - <exclusions> - <!-- Already provided by jclouds-sshj --> - <exclusion> - <groupId>org.bouncycastle</groupId> - <artifactId>bcprov-jdk15on</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>live</id> - - <build> - <defaultGoal>clean verify</defaultGoal> - - <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.azurecompute.endpoint>${test.azurecompute.endpoint}</test.azurecompute.endpoint> - <test.azurecompute.api-version>${test.azurecompute.api-version}</test.azurecompute.api-version> - <test.azurecompute.build-version>${test.azurecompute.build-version}</test.azurecompute.build-version> - <test.azurecompute.identity>${test.azurecompute.identity}</test.azurecompute.identity> - <test.azurecompute.credential>${test.azurecompute.credential}</test.azurecompute.credential> - <test.jclouds.azurecompute.subscription-id>${test.jclouds.azurecompute.subscription-id}</test.jclouds.azurecompute.subscription-id> - </systemPropertyVariables> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - -</project> http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java deleted file mode 100644 index d7e78f2..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java +++ /dev/null @@ -1,176 +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.azurecompute; - -import java.io.Closeable; - -import javax.ws.rs.PathParam; - -import org.jclouds.azurecompute.features.AffinityGroupApi; -import org.jclouds.azurecompute.features.CloudServiceApi; -import org.jclouds.azurecompute.features.DeploymentApi; -import org.jclouds.azurecompute.features.DiskApi; -import org.jclouds.azurecompute.features.LocationApi; -import org.jclouds.azurecompute.features.NetworkSecurityGroupApi; -import org.jclouds.azurecompute.features.OSImageApi; -import org.jclouds.azurecompute.features.OperationApi; -import org.jclouds.azurecompute.features.ReservedIPAddressApi; -import org.jclouds.azurecompute.features.ServiceCertificatesApi; -import org.jclouds.azurecompute.features.StorageAccountApi; -import org.jclouds.azurecompute.features.SubscriptionApi; -import org.jclouds.azurecompute.features.TrafficManagerApi; -import org.jclouds.azurecompute.features.VirtualMachineApi; -import org.jclouds.azurecompute.features.VirtualNetworkApi; -import org.jclouds.azurecompute.features.VMImageApi; -import org.jclouds.rest.annotations.Delegate; - -/** - * The Windows Azure Service Management API is a REST API for managing your services and deployments. - * <p/> - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460799" >doc</a> - */ -public interface AzureComputeApi extends Closeable { - - /** - * The Service Management API includes operations for managing affinity groups in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/azure/ee460798">docs</a> - */ - @Delegate - AffinityGroupApi getAffinityGroupApi(); - - /** - * The Service Management API includes operations for listing the available data center locations for a cloud service - * in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/gg441299">docs</a> - */ - @Delegate - LocationApi getLocationApi(); - - /** - * The Service Management API includes operations for managing the cloud services beneath your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460812">docs</a> - */ - @Delegate - CloudServiceApi getCloudServiceApi(); - - /** - * 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> - */ - @Delegate - DeploymentApi getDeploymentApiForService(@PathParam("serviceName") String serviceName); - - /** - * 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> - */ - // TODO: revisit once we have multi-level @Delegate working - @Delegate - VirtualMachineApi getVirtualMachineApiForDeploymentInService(@PathParam("deploymentName") String deploymentName, - @PathParam("serviceName") String serviceName); - - /** - * 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> - */ - @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> - */ - @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> - */ - @Delegate - DiskApi getDiskApi(); - - /** - * The Service Management API includes operations for retrieving information about a subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/azure/gg715315.aspx">docs</a> - */ - @Delegate - SubscriptionApi getSubscriptionApi(); - - /** - * The Service Management API includes operations for managing the virtual networks in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157182.aspx">docs</a> - */ - @Delegate - VirtualNetworkApi getVirtualNetworkApi(); - - /** - * The Service Management API includes operations for managing the storage accounts in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460790.aspx">docs</a> - */ - @Delegate - StorageAccountApi getStorageAccountApi(); - - /** - * The Service Management API includes operations for managing the Network Security Groups in your subscription. - * - */ - @Delegate - NetworkSecurityGroupApi getNetworkSecurityGroupApi(); - - /** - * The Service Management API includes operations for creating, updating, listing, and deleting Azure Traffic Manager - * profiles and definitions. - * - * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758255.aspx">docs</a> - */ - @Delegate - TrafficManagerApi getTrafficManaerApi(); - - /** - * The Service Management API includes operations for managing service certificates in your subscription. - * - * @see <a href="https://msdn.microsoft.com/en-us/library/azure/ee795178.aspx">docs</a> - */ - @Delegate - ServiceCertificatesApi getServiceCertificatesApi(); - - /** - * The Service Management API includes operations for managing the reserved IP addresses in your subscription. - * - * @see <a href="https://msdn.microsoft.com/en-us/library/azure/dn722420.aspxx">docs</a> - */ - @Delegate - ReservedIPAddressApi getReservedIPAddressApi(); - /* - * The Service Management API includes operations for managing the VM Images in your subscription. - */ - @Delegate - VMImageApi getVMImageApi(); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeProviderMetadata.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeProviderMetadata.java b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeProviderMetadata.java deleted file mode 100644 index 4a82f67..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeProviderMetadata.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.azurecompute; - -import static org.jclouds.azurecompute.config.AzureComputeProperties.DEALLOCATE_WHEN_SUSPENDING; -import static org.jclouds.azurecompute.config.AzureComputeProperties.OPERATION_POLL_INITIAL_PERIOD; -import static org.jclouds.azurecompute.config.AzureComputeProperties.OPERATION_POLL_MAX_PERIOD; -import static org.jclouds.azurecompute.config.AzureComputeProperties.OPERATION_TIMEOUT; -import static org.jclouds.azurecompute.config.AzureComputeProperties.TCP_RULE_FORMAT; -import static org.jclouds.azurecompute.config.AzureComputeProperties.TCP_RULE_REGEXP; -import java.net.URI; -import java.util.Properties; - -import org.jclouds.azurecompute.domain.Region; -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.internal.BaseProviderMetadata; - -import com.google.auto.service.AutoService; - -@AutoService(ProviderMetadata.class) -public class AzureComputeProviderMetadata extends BaseProviderMetadata { - - public static Builder builder() { - return new Builder(); - } - - @Override - public Builder toBuilder() { - return builder().fromProviderMetadata(this); - } - - public AzureComputeProviderMetadata() { - super(builder()); - } - - public static Properties defaultProperties() { - final Properties properties = AzureManagementApiMetadata.defaultProperties(); - properties.setProperty(OPERATION_TIMEOUT, "60000"); - properties.setProperty(OPERATION_POLL_INITIAL_PERIOD, "5"); - properties.setProperty(OPERATION_POLL_MAX_PERIOD, "15"); - properties.setProperty(TCP_RULE_FORMAT, "tcp_%s-%s"); - properties.setProperty(TCP_RULE_REGEXP, "tcp_\\d{1,5}-\\d{1,5}"); - properties.setProperty(DEALLOCATE_WHEN_SUSPENDING, "true"); - return properties; - } - - public AzureComputeProviderMetadata(final Builder builder) { - super(builder); - } - - public static class Builder extends BaseProviderMetadata.Builder { - - protected Builder() { - super(); - - id("azurecompute") - .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(Region.iso3166Codes()) - .defaultProperties(AzureComputeProviderMetadata.defaultProperties()); - } - - @Override - public AzureComputeProviderMetadata build() { - return new AzureComputeProviderMetadata(this); - } - - @Override - public Builder fromProviderMetadata(final ProviderMetadata providerMetadata) { - super.fromProviderMetadata(providerMetadata); - return this; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/AzureManagementApiMetadata.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureManagementApiMetadata.java b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureManagementApiMetadata.java deleted file mode 100644 index 406b029..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureManagementApiMetadata.java +++ /dev/null @@ -1,89 +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.azurecompute; - -import static org.jclouds.reflect.Reflection2.typeToken; - -import java.net.URI; -import java.util.Properties; - -import org.jclouds.apis.ApiMetadata; -import org.jclouds.azurecompute.compute.config.AzureComputeServiceContextModule; -import org.jclouds.azurecompute.config.AzureComputeHttpApiModule; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.internal.BaseHttpApiMetadata; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * Implementation of {@link ApiMetadata} for Microsoft Service Management Service API - */ -public class AzureManagementApiMetadata extends BaseHttpApiMetadata<AzureComputeApi> { - - @Override - public Builder toBuilder() { - return new Builder().fromApiMetadata(this); - } - - public AzureManagementApiMetadata() { - this(new Builder()); - } - - protected AzureManagementApiMetadata(final Builder builder) { - super(builder); - } - - public static Properties defaultProperties() { - final Properties properties = BaseHttpApiMetadata.defaultProperties(); - // Sometimes SSH Authentication failure happens in Azure. - // It seems that the authorized key is injected after ssh has been started. - properties.setProperty("jclouds.ssh.max-retries", "15"); - properties.setProperty("jclouds.ssh.retry-auth", "true"); - return properties; - } - - public static class Builder extends BaseHttpApiMetadata.Builder<AzureComputeApi, Builder> { - - protected Builder() { - super(); - - id("azurecompute") - .name("Microsoft Azure Service Management Service API") - .version("2014-10-01") - .identityName("Path to Management Certificate .p12 file, or PEM string") - .credentialName("Password to Management Certificate") - .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>>builder() - .add(AzureComputeServiceContextModule.class) - .add(AzureComputeHttpApiModule.class).build()); - } - - @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/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CaptureVMImageParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CaptureVMImageParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CaptureVMImageParamsToXML.java deleted file mode 100644 index b8ac478..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CaptureVMImageParamsToXML.java +++ /dev/null @@ -1,68 +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.azurecompute.binders; - -import com.jamesmurty.utils.XMLBuilder; -import org.jclouds.azurecompute.domain.CaptureVMImageParams; -import org.jclouds.azurecompute.domain.RoleSize; - -import static org.jclouds.azurecompute.domain.VMImage.OSDiskConfiguration.OSState.GENERALIZED; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import static com.google.common.base.Throwables.propagate; - -public final class CaptureVMImageParamsToXML implements Binder { - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - CaptureVMImageParams params = CaptureVMImageParams.class.cast(input); - - try { - XMLBuilder builder = XMLBuilder.create("CaptureRoleAsVMImageOperation", "http://schemas.microsoft.com/windowsazure") - .namespace("i", "http://www.w3.org/2001/XMLSchema-instance") - .e("OperationType").t("CaptureRoleAsVMImageOperation").up() - .e("OSState").t(params.osState() == GENERALIZED ? "Generalized" : "Specialized").up() - .e("VMImageName").t(params.name()).up() - .e("VMImageLabel").t(params.label()).up(); - add(builder, "Description", params.description()); - add(builder, "Language", params.language()); - add(builder, "ImageFamily", params.imageFamily()); - - RoleSize.Type vmSize = params.recommendedVMSize(); - if (vmSize != null) { - String vmSizeText = params.recommendedVMSize().getText(); - builder.e("RecommendedVMSize").t(vmSizeText).up(); - } - - builder.up(); - - return (R) request.toBuilder().payload(builder.asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } - - private XMLBuilder add(XMLBuilder xmlBuilder, String entity, String text) { - if (text != null) { - return xmlBuilder.e(entity).t(text).up(); - } else { - return xmlBuilder.e(entity).up(); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateAffinityGroupParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateAffinityGroupParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateAffinityGroupParamsToXML.java deleted file mode 100644 index 5b71be2..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateAffinityGroupParamsToXML.java +++ /dev/null @@ -1,50 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import com.google.common.base.Charsets; -import com.google.common.io.BaseEncoding; - -import com.jamesmurty.utils.XMLBuilder; - -import org.jclouds.azurecompute.domain.CreateAffinityGroupParams; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -public final class CreateAffinityGroupParamsToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(final R request, final Object input) { - final CreateAffinityGroupParams params = CreateAffinityGroupParams.class.cast(input); - - try { - XMLBuilder builder = XMLBuilder.create("CreateAffinityGroup", "http://schemas.microsoft.com/windowsazure") - .e("Name").t(params.name()).up() - .e("Label").t(BaseEncoding.base64().encode(params.label().getBytes(Charsets.UTF_8))).up(); - if (params.description() != null) { - builder.e("Description").t(params.description()).up(); - } - String xml = builder.e("Location").t(params.location()).up().asString(); - return (R) request.toBuilder().payload(xml).build(); - } catch (Exception e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateStorageServiceParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateStorageServiceParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateStorageServiceParamsToXML.java deleted file mode 100644 index 9221062..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/CreateStorageServiceParamsToXML.java +++ /dev/null @@ -1,76 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.azurecompute.domain.CreateStorageServiceParams; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.google.common.base.Charsets; -import com.google.common.io.BaseEncoding; -import com.jamesmurty.utils.XMLBuilder; -import java.util.Map; - -public final class CreateStorageServiceParamsToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(final R request, final Object input) { - final CreateStorageServiceParams params = CreateStorageServiceParams.class.cast(input); - - try { - final XMLBuilder builder = XMLBuilder.create( - "CreateStorageServiceInput", "http://schemas.microsoft.com/windowsazure"). - e("ServiceName").t(params.serviceName()).up(); - - if (params.description() != null) { - builder.e("Description").t(params.description()).up(); - } - - if (params.label() != null) { - builder.e("Label").t(BaseEncoding.base64().encode(params.label().getBytes(Charsets.UTF_8))).up(); - } - - if (params.location() != null) { - builder.e("Location").t(params.location()).up(); - } - if (params.affinityGroup() != null) { - builder.e("AffinityGroup").t(params.affinityGroup()).up(); - } - - if (params.extendedProperties() != null) { - final XMLBuilder extProps = builder.e("ExtendedProperties"); - for (Map.Entry<String, String> entry : params.extendedProperties().entrySet()) { - final XMLBuilder extProp = extProps.e("ExtendedProperty"); - extProp.e("Name").t(entry.getKey()).up(); - extProp.e("Value").t(entry.getValue()).up(); - extProp.up(); - } - extProps.up(); - } - - builder.e("AccountType").t(params.accountType().name()).up(); - - return (R) request.toBuilder().payload(builder.asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/DeploymentParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/DeploymentParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/DeploymentParamsToXML.java deleted file mode 100644 index d890ebe..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/DeploymentParamsToXML.java +++ /dev/null @@ -1,141 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.azurecompute.domain.OSImage.Type.LINUX; - -import org.jclouds.azurecompute.domain.DeploymentParams; -import org.jclouds.azurecompute.domain.OSImage; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; - -/** - * Generates XML for <a href="https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx">Create Virtual Machine Deployment</a> REST call. - */ -public final class DeploymentParamsToXML implements Binder { - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - DeploymentParams params = DeploymentParams.class.cast(input); - - try { - XMLBuilder deploymentBuilder = XMLBuilder.create("Deployment", "http://schemas.microsoft.com/windowsazure") - .e("Name").t(params.name()).up() - .e("DeploymentSlot").t("Production").up() - .e("Label").t(params.name()).up(); - XMLBuilder roleBuilder = deploymentBuilder - .e("RoleList") - .e("Role") - .e("RoleName").t(params.name()).up() - .e("RoleType").t("PersistentVMRole").up(); - XMLBuilder configSetsBuilder = roleBuilder.e("ConfigurationSets"); - - if (params.os() == OSImage.Type.WINDOWS) { - XMLBuilder configBuilder = configSetsBuilder.e("ConfigurationSet"); // Windows - final String listenerProtocol = params.winrmUseHttps() != null && params.winrmUseHttps() ? "Https" : "Http"; - configBuilder.e("ConfigurationSetType").t("WindowsProvisioningConfiguration").up() - .e("ComputerName").t(params.name()).up() - .e("AdminPassword").t(params.password()).up() - .e("ResetPasswordOnFirstLogon").t("false").up() - .e("EnableAutomaticUpdate").t("false").up() - .e("DomainJoin") - .e("Credentials") - .e("Domain").t(params.name()).up() - .e("Username").t(params.username()).up() - .e("Password").t(params.password()).up() - .up() // Credentials - .e("JoinDomain").t(params.name()).up() - .up() // Domain Join - .e("StoredCertificateSettings").up() - .e("WinRM") - .e("Listeners") - .e("Listener") - .e("Protocol").t(listenerProtocol).up().up().up().up() - .e("AdminUsername").t(params.username()).up() - .e("AdminPassword").t(params.username()).up() - .up(); // Windows ConfigurationSet - } else if (params.os() == OSImage.Type.LINUX) { - XMLBuilder configBuilder = configSetsBuilder.e("ConfigurationSet"); // Linux - configBuilder.e("ConfigurationSetType").t("LinuxProvisioningConfiguration").up() - .e("HostName").t(params.name()).up() - .e("UserName").t(params.username()).up() - .e("UserPassword").t(params.password()).up() - .e("DisableSshPasswordAuthentication").t("false").up() - .e("SSH") - .e("PublicKeys").up() - .e("KeyPairs").up() - .up(); // Linux ConfigurationSet - } else { - throw new IllegalArgumentException("Unrecognized os type " + params); - } - - XMLBuilder configBuilder = configSetsBuilder.e("ConfigurationSet"); // Network - configBuilder.e("ConfigurationSetType").t("NetworkConfiguration").up(); - - XMLBuilder inputEndpoints = configBuilder.e("InputEndpoints"); - for (DeploymentParams.ExternalEndpoint endpoint : params.externalEndpoints()) { - XMLBuilder inputBuilder = inputEndpoints.e("InputEndpoint"); - inputBuilder.e("LocalPort").t(Integer.toString(endpoint.localPort())).up() - .e("Name").t(endpoint.name()).up() - .e("Port").t(Integer.toString(endpoint.port())).up() - .e("Protocol").t(endpoint.protocol().toLowerCase()).up() - .up(); //InputEndpoint - } - - inputEndpoints.up(); - - XMLBuilder subnetNames = configBuilder.e("SubnetNames"); - if (!params.subnetNames().isEmpty()) { - for (String subnetName : params.subnetNames()) { - subnetNames.e("SubnetName").t(subnetName).up() - .up(); //subnetName - } - } - - roleBuilder - // TODO No Disk should be specified for a Role if using a VMImage - .e("DataVirtualHardDisks").up() - .e("OSVirtualHardDisk") - .e("HostCaching").t("ReadWrite").up() - .e("MediaLink").t(params.mediaLink().toASCIIString()).up() - // TODO - /// If you are using a VM image, it must be specified as VMImageName for the role, - // not as SourceImageNamefor OSVirtualHardDisk.</Message></Error>] - .e("SourceImageName").t(params.sourceImageName()).up() - .e("OS").t(params.os() == LINUX ? "Linux" : "Windows").up() - .up() //OSVirtualHardDisk - .e("RoleSize").t(params.size().getText()).up(); - if (params.provisionGuestAgent() != null) { - roleBuilder.e("ProvisionGuestAgent").t(params.provisionGuestAgent().toString()).up(); - } - if (params.virtualNetworkName() != null) { - configSetsBuilder.up().up().up().e("VirtualNetworkName").t(params.virtualNetworkName()).up(); - } - if (params.reservedIPName() != null) { - configSetsBuilder.up().up().up().e("ReservedIPName").t(params.reservedIPName()).up(); - } - - return (R) request.toBuilder().payload(configSetsBuilder.asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkConfigurationToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkConfigurationToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkConfigurationToXML.java deleted file mode 100644 index ce32b27..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkConfigurationToXML.java +++ /dev/null @@ -1,70 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.azurecompute.domain.NetworkConfiguration; -import org.jclouds.azurecompute.domain.NetworkConfiguration.Subnet; -import org.jclouds.azurecompute.domain.NetworkConfiguration.VirtualNetworkSite; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; - -public class NetworkConfigurationToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - NetworkConfiguration networkConfiguration = NetworkConfiguration.class.cast(input); - - try { - XMLBuilder builder = XMLBuilder.create( - "NetworkConfiguration", "http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration") - .e("VirtualNetworkConfiguration"); - if (networkConfiguration.virtualNetworkConfiguration().dns() == null) { - builder.e("Dns"); - } else { - builder.e("Dns").t(networkConfiguration.virtualNetworkConfiguration().dns()); - } - if (!networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites().isEmpty()) { - XMLBuilder virtualNetworkSitesBuilder = builder.e("VirtualNetworkSites"); - for (VirtualNetworkSite virtualNetworkSite - : networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites()) { - - XMLBuilder virtualNetworkSiteBuilder = virtualNetworkSitesBuilder. - e("VirtualNetworkSite"). - a("name", virtualNetworkSite.name()). - a("Location", virtualNetworkSite.location()); - virtualNetworkSiteBuilder.e("AddressSpace") - .e("AddressPrefix"). - t(virtualNetworkSite.addressSpace().addressPrefix()). - up(); - XMLBuilder subnetBuilder = virtualNetworkSiteBuilder.e("Subnets"); - for (Subnet subnet : virtualNetworkSite.subnets()) { - subnetBuilder.e("Subnet").a("name", subnet.name()).e("AddressPrefix").t(subnet.addressPrefix()); - } - } - } - return (R) request.toBuilder().payload(builder.asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkSecurityGroupToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkSecurityGroupToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkSecurityGroupToXML.java deleted file mode 100644 index 3a42823..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/NetworkSecurityGroupToXML.java +++ /dev/null @@ -1,47 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.azurecompute.domain.NetworkSecurityGroup; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; - -public class NetworkSecurityGroupToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - NetworkSecurityGroup networkSecurityGroup = NetworkSecurityGroup.class.cast(input); - try { - XMLBuilder builder = XMLBuilder.create("NetworkSecurityGroup", "http://schemas.microsoft.com/windowsazure") - .e("Name").t(networkSecurityGroup.name()).up(); - if (networkSecurityGroup.label() != null) { - builder.e("Label").t(networkSecurityGroup.label()).up(); - } - if (networkSecurityGroup.location() != null) { - builder.e("Location").t(networkSecurityGroup.location()).up(); - } - return (R) request.toBuilder().payload(builder.asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/OSImageParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/OSImageParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/OSImageParamsToXML.java deleted file mode 100644 index 32eaa0a..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/OSImageParamsToXML.java +++ /dev/null @@ -1,46 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.azurecompute.domain.OSImage.Type.LINUX; - -import org.jclouds.azurecompute.domain.OSImageParams; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; - -public final class OSImageParamsToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - OSImageParams params = OSImageParams.class.cast(input); - try { - String xml = XMLBuilder.create("OSImage", "http://schemas.microsoft.com/windowsazure") - .e("Label").t(params.label()).up() - .e("MediaLink").t(params.mediaLink().toASCIIString()).up() - .e("Name").t(params.name()).up() - .e("OS").t(params.os() == LINUX ? "Linux" : "Windows").up() - .up().asString(); - return (R) request.toBuilder().payload(xml).build(); - } catch (Exception e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java deleted file mode 100644 index 413fe8a..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileDefinitionParamsToXML.java +++ /dev/null @@ -1,79 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; -import org.jclouds.azurecompute.domain.ProfileDefinitionEndpointParams; -import org.jclouds.azurecompute.domain.ProfileDefinitionParams; - -public final class ProfileDefinitionParamsToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(final R request, final Object input) { - final ProfileDefinitionParams params = ProfileDefinitionParams.class.cast(input); - try { - XMLBuilder bld = XMLBuilder.create("Definition", "http://schemas.microsoft.com/windowsazure"); - bld.e("DnsOptions").e("TimeToLiveInSeconds").t(params.ttl().toString()).up().up(); - - bld.e("Monitors").e("Monitor").e("IntervalInSeconds").t("30").up() - .e("TimeoutInSeconds").t("10").up() - .e("ToleratedNumberOfFailures").t("3").up() - .e("Protocol").t(params.protocol().name()).up() - .e("Port").t(params.port().toString()).up() - .e("HttpOptions") - .e("Verb").t("GET").up() - .e("RelativePath").t(params.path()).up() - .e("ExpectedStatusCode").t("200"); - - bld = bld.e("Policy").e("LoadBalancingMethod").t(params.lb().getValue()).up() - .e("Endpoints"); - - for (ProfileDefinitionEndpointParams endpoint : params.endpoints()) { - bld = bld.e("Endpoint") - .e("DomainName").t(endpoint.domain()).up() - .e("Status").t(endpoint.status().getValue()).up(); - - if (endpoint.type() != null) { - bld = bld.e("Type").t(endpoint.type().getValue()).up(); - } - if (endpoint.location() != null) { - bld = bld.e("Location").t(endpoint.location()).up(); - } - if (endpoint.min() != null) { - bld = bld.e("MinChildEndpoints").t(endpoint.min().toString()).up(); - } - if (endpoint.weight() != null) { - bld = bld.e("Weight").t(endpoint.weight().toString()).up(); - } - - bld = bld.up(); - } - - bld.up().up(); - - return (R) request.toBuilder().payload(bld.up().asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java deleted file mode 100644 index eb6970d..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ProfileParamsToXML.java +++ /dev/null @@ -1,51 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; -import org.jclouds.azurecompute.domain.CreateProfileParams; -import org.jclouds.azurecompute.domain.UpdateProfileParams; - -public final class ProfileParamsToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(final R request, final Object input) { - - try { - final XMLBuilder bld = XMLBuilder.create("Profile", "http://schemas.microsoft.com/windowsazure"); - if (input instanceof CreateProfileParams) { - final CreateProfileParams params = CreateProfileParams.class.cast(input); - bld.e("DomainName").t(params.domain()).up(); - bld.e("Name").t(params.name()).up().up(); - return (R) request.toBuilder().payload(bld.up().asString()).build(); - } else { - final UpdateProfileParams params = UpdateProfileParams.class.cast(input); - bld.e("Status").t(params.status().getValue()).up(); - bld.e("StatusDetails").e("EnabledVersion").t("1").up().up().up(); - return (R) request.toBuilder().payload(bld.up().asString()).build(); - } - } catch (Exception e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ReservedIPAddressParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ReservedIPAddressParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ReservedIPAddressParamsToXML.java deleted file mode 100644 index bdac946..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ReservedIPAddressParamsToXML.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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; -import org.jclouds.azurecompute.domain.ReservedIPAddressParams; - -public final class ReservedIPAddressParamsToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(final R request, final Object input) { - final ReservedIPAddressParams params = ReservedIPAddressParams.class.cast(input); - try { - final XMLBuilder bld = XMLBuilder.create("ReservedIP", "http://schemas.microsoft.com/windowsazure") - .e("Name").t(params.name()).up(); - - if (params.label() != null) { - bld.e("Label").t(params.label()).up(); - } - - bld.e("Location").t(params.location()).up(); - - return (R) request.toBuilder().payload(bld.up().asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RoleToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RoleToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RoleToXML.java deleted file mode 100644 index 9f77d76..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RoleToXML.java +++ /dev/null @@ -1,87 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.azurecompute.domain.Role; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; - -/** - * Generates XML request body for the <a href="https://msdn.microsoft.com/en-us/library/azure/jj157187.aspx">UpdateRole REST request</a>. - */ -public class RoleToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - Role role = Role.class.cast(input); - - try { - XMLBuilder builder = XMLBuilder.create("PersistentVMRole", "http://schemas.microsoft.com/windowsazure"); - builder.e("RoleName").t(role.roleName()).up() - .e("RoleType").t(role.roleType()).up(); - XMLBuilder configSetsBuilder = builder.e("ConfigurationSets"); - if (!role.configurationSets().isEmpty()) { - for (Role.ConfigurationSet configurationSet : role.configurationSets()) { - XMLBuilder configBuilder = configSetsBuilder.e("ConfigurationSet"); // Network - configBuilder.e("ConfigurationSetType").t(configurationSet.configurationSetType()).up(); - - XMLBuilder inputEndpoints = configBuilder.e("InputEndpoints"); - for (Role.ConfigurationSet.InputEndpoint endpoint : configurationSet.inputEndpoints()) { - XMLBuilder inputBuilder = inputEndpoints.e("InputEndpoint"); - inputBuilder.e("LocalPort").t(Integer.toString(endpoint.localPort())).up() - .e("Name").t(endpoint.name()).up() - .e("Port").t(Integer.toString(endpoint.port())).up() - .e("Protocol").t(endpoint.protocol().toLowerCase()).up() - .up(); //InputEndpoint - } - XMLBuilder subnetNames = configBuilder.e("SubnetNames"); - if (!configurationSet.subnetNames().isEmpty()) { - for (Role.ConfigurationSet.SubnetName subnetName : configurationSet.subnetNames()) { - subnetNames.e("SubnetName").t(subnetName.name()).up(); - } - } - if (configurationSet.networkSecurityGroup() != null - && !configurationSet.networkSecurityGroup().isEmpty()) { - configBuilder.e("NetworkSecurityGroup").t(configurationSet.networkSecurityGroup()).up(); - } - } - } - - builder.e("DataVirtualHardDisks").up() - .e("OSVirtualHardDisk") - .e("HostCaching").t(role.osVirtualHardDisk().hostCaching()).up() - .e("DiskName").t(role.osVirtualHardDisk().diskName()).up() - .e("MediaLink").t(role.osVirtualHardDisk().mediaLink().toString()).up() - .e("SourceImageName").t(role.osVirtualHardDisk().sourceImageName()).up() - .e("OS").t(role.osVirtualHardDisk().os().toString()).up() - .up() // OSVirtualHardDisk - .e("RoleSize").t(role.roleSize().getText()); - if (role.provisionGuestAgent() != null) { - builder.e("ProvisionGuestAgent").t(role.provisionGuestAgent().toString()).up(); - } - return (R) request.toBuilder().payload(builder.asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RuleToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RuleToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RuleToXML.java deleted file mode 100644 index bcb1b3a..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/RuleToXML.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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.azurecompute.domain.Rule; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; - -public final class RuleToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - Rule rule = Rule.class.cast(input); - try { - String xml = XMLBuilder.create("Rule", "http://schemas.microsoft.com/windowsazure") - .e("Type").t(rule.type().name()).up() - .e("Priority").t(rule.priority()).up() - .e("Action").t(rule.action().name()).up() - .e("SourceAddressPrefix").t(rule.sourceAddressPrefix()).up() - .e("SourcePortRange").t(rule.sourcePortRange()).up() - .e("DestinationAddressPrefix").t(rule.destinationAddressPrefix()).up() - .e("DestinationPortRange").t(rule.destinationPortRange()).up() - .e("Protocol").t(rule.protocol().getValue()).up().asString(); - return (R) request.toBuilder().payload(xml).build(); - } catch (Exception e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b8ab3758/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ServiceCertificateParamsToXML.java ---------------------------------------------------------------------- diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ServiceCertificateParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ServiceCertificateParamsToXML.java deleted file mode 100644 index 49c18ff..0000000 --- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ServiceCertificateParamsToXML.java +++ /dev/null @@ -1,47 +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.azurecompute.binders; - -import static com.google.common.base.Throwables.propagate; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -import com.jamesmurty.utils.XMLBuilder; -import org.jclouds.azurecompute.domain.ServiceCertificateParams; - -public final class ServiceCertificateParamsToXML implements Binder { - - @Override - @SuppressWarnings("unchecked") - public <R extends HttpRequest> R bindToRequest(final R request, final Object input) { - final ServiceCertificateParams params = ServiceCertificateParams.class.cast(input); - try { - final XMLBuilder bld = XMLBuilder.create("CertificateFile", "http://schemas.microsoft.com/windowsazure") - .e("Data").t(params.data()).up() - .e("CertificateFormat").t(params.format()).up(); - - if (params.password() != null) { - bld.e("Password").t(params.password()).up(); - } - - return (R) request.toBuilder().payload(bld.up().asString()).build(); - } catch (Exception e) { - throw propagate(e); - } - } -}
