Remove ProfitBricks
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/93aff921 Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/93aff921 Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/93aff921 Branch: refs/heads/master Commit: 93aff9219883708a07ebebd303199c4426ba3ab1 Parents: 7b8adc6 Author: Reijhanniel Jearl Campos <[email protected]> Authored: Sat Feb 20 00:43:56 2016 +0800 Committer: Reijhanniel Jearl Campos <[email protected]> Committed: Sat Feb 20 00:43:56 2016 +0800 ---------------------------------------------------------------------- pom.xml | 1 - profitbricks/README.md | 61 --- profitbricks/pom.xml | 151 ------ .../jclouds/profitbricks/ProfitBricksApi.java | 64 --- .../profitbricks/ProfitBricksApiMetadata.java | 85 ---- .../ProfitBricksProviderMetadata.java | 114 ----- .../binder/BaseProfitBricksRequestBinder.java | 75 --- .../CreateDataCenterRequestBinder.java | 44 -- .../UpdateDataCenterRequestBinder.java | 44 -- .../drive/AddRomDriveToServerRequestBinder.java | 45 -- .../AddFirewallRuleToNicRequestBinder.java | 53 -- .../binder/firewall/FirewallBinder.java | 95 ---- .../CreateLoadBalancerRequestBinder.java | 50 -- .../DeregisterLoadBalancerRequestBinder.java | 42 -- .../RegisterLoadBalancerRequestBinder.java | 44 -- .../UpdateLoadBalancerRequestBinder.java | 44 -- .../binder/nic/CreateNicRequestBinder.java | 46 -- .../binder/nic/SetInternetAccessBinder.java | 42 -- .../binder/nic/UpdateNicRequestBinder.java | 46 -- .../server/CreateServerRequestBinder.java | 57 --- .../server/UpdateServerRequestBinder.java | 56 --- .../snapshot/CreateSnapshotRequestBinder.java | 44 -- .../snapshot/RollbackSnapshotRequestBinder.java | 43 -- .../snapshot/UpdateSnapshotRequestBinder.java | 53 -- .../ConnectStorageToServerRequestBinder.java | 45 -- .../storage/CreateStorageRequestBinder.java | 46 -- .../storage/UpdateStorageRequestBinder.java | 47 -- .../ProfitBricksComputeServiceAdapter.java | 483 ------------------- .../compute/concurrent/ProvisioningJob.java | 62 --- .../compute/concurrent/ProvisioningManager.java | 88 ---- ...ProfitBricksComputeServiceContextModule.java | 223 --------- .../compute/function/ProvisionableToImage.java | 241 --------- .../compute/function/ServerToNodeMetadata.java | 168 ------- .../compute/function/StorageToVolume.java | 47 -- .../strategy/AssignDataCenterToTemplate.java | 110 ----- .../strategy/TemplateWithDataCenter.java | 107 ---- .../config/ProfitBricksComputeProperties.java | 32 -- .../config/ProfitBricksHttpApiModule.java | 70 --- .../profitbricks/domain/AvailabilityZone.java | 32 -- .../jclouds/profitbricks/domain/DataCenter.java | 121 ----- .../org/jclouds/profitbricks/domain/Drive.java | 55 --- .../jclouds/profitbricks/domain/Firewall.java | 188 -------- .../org/jclouds/profitbricks/domain/Image.java | 128 ----- .../jclouds/profitbricks/domain/IpBlock.java | 103 ---- .../profitbricks/domain/LoadBalancer.java | 257 ---------- .../jclouds/profitbricks/domain/Location.java | 60 --- .../org/jclouds/profitbricks/domain/Nic.java | 248 ---------- .../org/jclouds/profitbricks/domain/OsType.java | 28 -- .../profitbricks/domain/Provisionable.java | 35 -- .../profitbricks/domain/ProvisioningState.java | 28 -- .../org/jclouds/profitbricks/domain/Server.java | 410 ---------------- .../profitbricks/domain/ServiceFault.java | 70 --- .../jclouds/profitbricks/domain/Snapshot.java | 251 ---------- .../jclouds/profitbricks/domain/Storage.java | 234 --------- .../profitbricks/features/DataCenterApi.java | 134 ----- .../profitbricks/features/DrivesApi.java | 51 -- .../profitbricks/features/FirewallApi.java | 93 ---- .../jclouds/profitbricks/features/ImageApi.java | 65 --- .../profitbricks/features/IpBlockApi.java | 83 ---- .../profitbricks/features/LoadBalancerApi.java | 93 ---- .../jclouds/profitbricks/features/NicApi.java | 88 ---- .../profitbricks/features/ServerApi.java | 166 ------- .../profitbricks/features/SnapshotApi.java | 87 ---- .../profitbricks/features/StorageApi.java | 137 ------ .../handlers/ProfitBricksHttpErrorHandler.java | 75 --- ...usFromPayloadHttpCommandExecutorService.java | 140 ------ .../ProfitBricksSoapMessageEnvelope.java | 59 --- .../parser/BaseProfitBricksResponseHandler.java | 68 --- .../parser/RequestIdOnlyResponseHandler.java | 45 -- .../parser/ServiceFaultResponseHandler.java | 58 --- .../BaseDataCenterResponseHandler.java | 38 -- .../DataCenterInfoResponseHandler.java | 110 ----- .../DataCenterListResponseHandler.java | 61 --- .../firewall/BaseFirewallResponseHandler.java | 69 --- .../firewall/FirewallListResponseHandler.java | 68 --- .../firewall/FirewallResponseHandler.java | 63 --- .../rule/BaseFirewallRuleResponseHandler.java | 54 --- .../rule/FirewallRuleListResponseHandler.java | 54 --- .../parser/image/BaseImageResponseHandler.java | 71 --- .../parser/image/ImageInfoResponseHandler.java | 44 -- .../parser/image/ImageListResponseHandler.java | 49 -- .../ipblock/BaseIpBlockResponseHandler.java | 69 --- .../ipblock/IpBlockListResponseHandler.java | 64 --- .../parser/ipblock/IpBlockResponseHandler.java | 64 --- .../BaseLoadBalancerResponseHandler.java | 114 ----- .../LoadBalancerIdOnlyResponseHandler.java | 51 -- .../LoadBalancerListResponseHandler.java | 79 --- .../LoadBalancerResponseHandler.java | 68 --- .../http/parser/nic/BaseNicResponseHandler.java | 87 ---- .../parser/nic/NicIdOnlyResponseHandler.java | 51 -- .../http/parser/nic/NicListResponseHandler.java | 73 --- .../http/parser/nic/NicResponseHandler.java | 63 --- .../publicip/BasePublicIpResponseHandler.java | 38 -- .../publicip/PublicIpListResponseHandler.java | 53 -- .../server/BaseServerResponseHandler.java | 136 ------ .../server/ServerIdOnlyResponseHandler.java | 51 -- .../server/ServerInfoResponseHandler.java | 69 --- .../server/ServerListResponseHandler.java | 89 ---- .../snapshot/BaseSnapshotResponseHandler.java | 83 ---- .../snapshot/SnapshotListResponseHandler.java | 54 --- .../snapshot/SnapshotResponseHandler.java | 49 -- .../GetProvisioningStateResponseHandler.java | 47 -- .../storage/BaseStorageResponseHandler.java | 81 ---- .../storage/StorageIdOnlyResponseHandler.java | 46 -- .../storage/StorageInfoResponseHandler.java | 51 -- .../storage/StorageListResponseHandler.java | 61 --- .../jclouds/profitbricks/util/MacAddresses.java | 29 -- .../jclouds/profitbricks/util/Passwords.java | 64 --- .../profitbricks/util/Preconditions.java | 100 ---- .../profitbricks/BaseProfitBricksLiveTest.java | 186 ------- .../ProfitBricksProviderMetadataTest.java | 29 -- .../CreateDataCenterRequestBinderTest.java | 47 -- .../UpdateDataCenterRequestBinderTest.java | 46 -- .../AddRomDriveToServerRequestBinderTest.java | 49 -- .../AddFirewallRuleToNicRequestBinderTest.java | 65 --- .../binder/firewall/FirewallBinderTest.java | 131 ----- .../CreateLoadBalancerRequestBinderTest.java | 68 --- ...DeregisterLoadBalancerRequestBinderTest.java | 47 -- .../RegisterLoadBalancerRequestBinderTest.java | 46 -- .../UpdateLoadBalancerRequestBinderTest.java | 61 --- .../binder/nic/CreateNicRequestBinderTest.java | 53 -- .../binder/nic/SetInternetAccessBinderTest.java | 48 -- .../binder/nic/UpdateNicRequestBinderTest.java | 54 --- .../server/CreateServerRequestBinderTest.java | 65 --- .../server/UpdateServerRequestBinderTest.java | 64 --- .../CreateSnapshotRequestBinderTest.java | 51 -- .../RollbackSnapshotRequestBinderTest.java | 44 -- .../UpdateSnapshotRequestBinderTest.java | 74 --- ...ConnectStorageToServerRequestBinderTest.java | 55 --- .../storage/CreateStorageRequestBinderTest.java | 56 --- .../storage/UpdateStorageRequestBinderTest.java | 53 -- .../ProfitBricksComputeServiceLiveTest.java | 73 --- .../ProfitBricksTemplateBuilderLiveTest.java | 103 ---- .../concurrent/ProvisioningManagerTest.java | 118 ----- .../compute/config/StatusPredicateTest.java | 145 ------ .../function/ProvisionableToImageTest.java | 271 ----------- .../function/ServerToNodeMetadataTest.java | 204 -------- .../compute/function/StorageToVolumeTest.java | 61 --- .../domain/FirewallRuleBuilderTest.java | 82 ---- .../profitbricks/domain/ServerBuilderTest.java | 162 ------- .../features/DataCenterApiLiveTest.java | 123 ----- .../features/DataCenterApiMockTest.java | 271 ----------- .../features/DrivesApiLiveTest.java | 77 --- .../features/DrivesApiMockTest.java | 81 ---- .../features/FirewallApiLiveTest.java | 139 ------ .../features/FirewallApiMockTest.java | 324 ------------- .../profitbricks/features/ImageApiLiveTest.java | 62 --- .../profitbricks/features/ImageApiMockTest.java | 116 ----- .../features/IpBlockApiLiveTest.java | 111 ----- .../features/IpBlockApiMockTest.java | 200 -------- .../features/LoadBalancerApiLiveTest.java | 157 ------ .../features/LoadBalancerApiMockTest.java | 285 ----------- .../profitbricks/features/NicApiLiveTest.java | 124 ----- .../profitbricks/features/NicApiMockTest.java | 237 --------- .../features/ServerApiLiveTest.java | 129 ----- .../features/ServerApiMockTest.java | 363 -------------- .../features/SnapshotApiLiveTest.java | 168 ------- .../features/SnapshotApiMockTest.java | 268 ---------- .../features/StorageApiLiveTest.java | 150 ------ .../features/StorageApiMockTest.java | 285 ----------- ...omPayloadHttpCommandExecutorServiceTest.java | 149 ------ .../ProfitBricksSoapMessageEnvelopeTest.java | 57 --- .../http/parser/BaseResponseHandlerTest.java | 61 --- .../RequestIdOnlyResponseHandlerTest.java | 76 --- .../parser/ServiceFaultResponseHandlerTest.java | 49 -- .../DataCenterInfoResponseHandlerTest.java | 142 ------ .../DataCenterListResponseHandlerTest.java | 53 -- .../FirewallListResponseHandlerTest.java | 87 ---- .../firewall/FirewallResponseHandlerTest.java | 71 --- .../image/ImageInfoResponseHandlerTest.java | 65 --- .../image/ImageListResponseHandlerTest.java | 183 ------- .../ipblock/IpBlockListResponseHandlerTest.java | 76 --- .../ipblock/IpBlockResponseHandlerTest.java | 62 --- .../LoadBalancerIdOnlyResponseHandlerTest.java | 41 -- .../LoadBalancerListResponseHandlerTest.java | 124 ----- .../LoadBalancerResponseHandlerTest.java | 99 ---- .../nic/NicIdOnlyResponseHandlerTest.java | 40 -- .../parser/nic/NicListResponseHandlerTest.java | 95 ---- .../http/parser/nic/NicResponseHandlerTest.java | 68 --- .../server/ServerIdOnlyResponseHandlerTest.java | 40 -- .../server/ServerInfoResponseHandlerTest.java | 119 ----- .../server/ServerListResponseHandlerTest.java | 182 ------- .../SnapshotListResponseHandlerTest.java | 103 ---- .../snapshot/SnapshotResponseHandlerTest.java | 77 --- ...GetProvisioningStateResponseHandlerTest.java | 110 ----- .../StorageIdOnlyResponseHandlerTest.java | 42 -- .../storage/StorageInfoResponseHandlerTest.java | 65 --- .../storage/StorageListResponseHandlerTest.java | 79 --- .../internal/BaseProfitBricksMockTest.java | 104 ---- .../profitbricks/util/MacAddressesTest.java | 45 -- .../profitbricks/util/PasswordsTest.java | 53 -- .../resources/datacenter/datacenter-cleared.xml | 12 - .../resources/datacenter/datacenter-created.xml | 13 - .../resources/datacenter/datacenter-deleted.xml | 10 - .../datacenter/datacenter-not-found.xml | 17 - .../datacenter/datacenter-state-inprocess.xml | 8 - .../resources/datacenter/datacenter-state.xml | 8 - .../resources/datacenter/datacenter-updated.xml | 12 - .../test/resources/datacenter/datacenter.xml | 79 --- .../test/resources/datacenter/datacenters.xml | 19 - .../src/test/resources/drives/drives-add.xml | 12 - .../src/test/resources/drives/drives-remove.xml | 12 - profitbricks/src/test/resources/fault-400.xml | 17 - profitbricks/src/test/resources/fault-401.html | 43 -- profitbricks/src/test/resources/fault-404.xml | 17 - profitbricks/src/test/resources/fault-413.xml | 17 - .../resources/firewall/firewall-activate.xml | 12 - .../resources/firewall/firewall-addtonic.xml | 23 - .../resources/firewall/firewall-deactivate.xml | 12 - .../test/resources/firewall/firewall-delete.xml | 12 - .../test/resources/firewall/firewall-remove.xml | 12 - .../src/test/resources/firewall/firewall.xml | 23 - .../src/test/resources/firewall/firewalls.xml | 39 -- .../test/resources/image/image-not-found.xml | 17 - profitbricks/src/test/resources/image/image.xml | 26 - .../src/test/resources/image/images.xml | 140 ------ .../test/resources/ipblock/ipblock-addtonic.xml | 12 - .../test/resources/ipblock/ipblock-release.xml | 10 - .../resources/ipblock/ipblock-removefromnic.xml | 12 - .../test/resources/ipblock/ipblock-reserve.xml | 13 - .../src/test/resources/ipblock/ipblock.xml | 18 - .../src/test/resources/ipblock/ipblocks.xml | 30 -- .../loadbalancer/loadbalancer-create.xml | 13 - .../loadbalancer/loadbalancer-delete.xml | 12 - .../loadbalancer/loadbalancer-deregister.xml | 12 - .../loadbalancer/loadbalancer-register.xml | 19 - .../loadbalancer/loadbalancer-update.xml | 12 - .../resources/loadbalancer/loadbalancer.xml | 32 -- .../resources/loadbalancer/loadbalancers.xml | 57 --- .../src/test/resources/logback-test.xml | 74 --- .../src/test/resources/maintenance-503.html | 67 --- .../src/test/resources/nic/nic-create.xml | 13 - .../src/test/resources/nic/nic-delete.xml | 12 - .../test/resources/nic/nic-internetaccess.xml | 12 - .../src/test/resources/nic/nic-update.xml | 12 - profitbricks/src/test/resources/nic/nic.xml | 27 -- profitbricks/src/test/resources/nic/nics.xml | 49 -- .../src/test/resources/server/server-create.xml | 13 - .../src/test/resources/server/server-delete.xml | 13 - .../src/test/resources/server/server-reset.xml | 11 - .../src/test/resources/server/server-start.xml | 11 - .../resources/server/server-state-inprocess.xml | 28 -- .../src/test/resources/server/server-stop.xml | 11 - .../src/test/resources/server/server-update.xml | 13 - .../src/test/resources/server/server.xml | 59 --- .../src/test/resources/server/servers.xml | 109 ----- .../test/resources/snapshot/snapshot-create.xml | 11 - .../test/resources/snapshot/snapshot-delete.xml | 10 - .../resources/snapshot/snapshot-rollback.xml | 12 - .../snapshot/snapshot-state-inprocess.xml | 27 -- .../test/resources/snapshot/snapshot-update.xml | 10 - .../src/test/resources/snapshot/snapshot.xml | 27 -- .../src/test/resources/snapshot/snapshots.xml | 47 -- .../test/resources/storage/storage-connect.xml | 13 - .../test/resources/storage/storage-create.xml | 14 - .../test/resources/storage/storage-delete.xml | 13 - .../resources/storage/storage-disconnect.xml | 13 - .../storage/storage-state-inprocess.xml | 23 - .../test/resources/storage/storage-update.xml | 13 - .../src/test/resources/storage/storage.xml | 23 - .../src/test/resources/storage/storages.xml | 37 -- 261 files changed, 20012 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 2cb87e3..dba26ad 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,6 @@ <module>joyent-cloudapi</module> <module>joyentcloud</module> <module>abiquo</module> - <module>profitbricks</module> <module>profitbricks-rest</module> </modules> http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/README.md ---------------------------------------------------------------------- diff --git a/profitbricks/README.md b/profitbricks/README.md deleted file mode 100644 index 67db8dd..0000000 --- a/profitbricks/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# jclouds ProfitBricks - -## Terms -Like any cloud provider, ProfitBricks has its own set of terms in cloud computing. To abstract this into jclouds' Compute interface, these terms were associated: - -- Node - composite instance of `Server` and `Storage` -- Image - both *user-uploaded* and *provided* `Images`; and `Snapshots` -- Location - `DataCenters` and `Region` (Las Vegas, Frankfurt, etc.) -- Hardware - number of cores, RAM size and storage size - -## Getting Started - -Assuming that there's **atleast one** datacenter existing in your account, the provider needs only an *identity* (your ProfitBricks email), and *credentials* (password) to provision a `Node`, by using a ProfitBricks-provided ubuntu-12.04 image as a template. - -```java -ComputeService compute = ContextBuilder.newBuilder( "profitbricks" ) - .credentials( "profitbricks email", "password" ) - .buildView( ComputeServiceContext.class ) - .getComputeService(); -``` - - -This works well; however, we won't be able to use jclouds' ability to execute *scripts* on a remote node. This is because, ProfitBricks' default images require users to change passwords upon first log in. - -To enable jclouds to execute script, we need to use a custom image. The easiest way to do this is via ProfitBricks snapshot: - -- Go to your [DCD](https://my.profitbricks.com/dashboard/). -- Provision a server + storage, and connect it to the internet. Upon success, you will receive an email containing the credentials needed to login to your server. -- Login to your server, and change the password, as requested. - -``` -~ ssh root@<remote-ip> -... -Changing password for root. -(current) UNIX password: -Enter new UNIX password: -Retype new UNIX password: -~ root@ubuntu:~# exit - -``` - -- Go back to the DCD, and *make a snapshot* of the storage. Put a descriptive name. -- Configure jclouds to use this *snapshot*. - -```java -Template template = compute.templateBuilder() - .imageNameMatches( "<ideally-unique-snapshot-name>" ) - .options( compute.templateOptions() - .overrideLoginUser( "root" ) // unless you changed the user - .overrideLoginPassword( "<changed-password>" )) - // more options, as you need - .build(); - -compute.createNodesInGroup( "cluster1", 1, template ); -``` - -## Limitations - -- There's no direct way of specifying arbitrary number of cores, RAM size, and storage size via the compute interface, at least until after [JCLOUDS-482](https://issues.apache.org/jira/browse/JCLOUDS-482) is resolved. The adapter uses a predefined list hardware profiles instead. - -> Take note that these features are still accessible by *unwraping* the ProfitBricks API, but this'll reduce portability of your code. See [Concepts](https://jclouds.apache.org/start/concepts/). http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/pom.xml ---------------------------------------------------------------------- diff --git a/profitbricks/pom.xml b/profitbricks/pom.xml deleted file mode 100644 index 9311e48..0000000 --- a/profitbricks/pom.xml +++ /dev/null @@ -1,151 +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.api --> - <artifactId>profitbricks</artifactId> - <name>jclouds ProfitBricks api</name> - <description>jclouds components to access an implementation of ProfitBricks</description> - <packaging>bundle</packaging> - - <properties> - <test.profitbricks.endpoint>https://api.profitbricks.com/1.3</test.profitbricks.endpoint> - <test.profitbricks.identity>FIXME</test.profitbricks.identity> - <test.profitbricks.credential>FIXME</test.profitbricks.credential> - <test.profitbricks.api-version>1.3</test.profitbricks.api-version> - <jclouds.osgi.export>org.jclouds.profitbricks*;version="${project.version}"</jclouds.osgi.export> - <jclouds.osgi.import> - org.jclouds.labs*;version="${project.version}", - org.jclouds*;version="${jclouds.version}", - * - </jclouds.osgi.import> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-core</artifactId> - <version>${jclouds.version}</version> - </dependency> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-compute</artifactId> - <version>${jclouds.version}</version> - </dependency> - <dependency> - <groupId>com.google.auto.service</groupId> - <artifactId>auto-service</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>com.google.auto.value</groupId> - <artifactId>auto-value</artifactId> - <scope>provided</scope> - </dependency> - <!-- Test dependencies --> - <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</groupId> - <artifactId>jclouds-compute</artifactId> - <version>${jclouds.version}</version> - <type>test-jar</type> - <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>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> - <dependency> - <groupId>org.apache.jclouds.driver</groupId> - <artifactId>jclouds-slf4j</artifactId> - <version>${jclouds.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <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> - <threadCount>1</threadCount> - <systemPropertyVariables> - <test.profitbricks.endpoint>${test.profitbricks.endpoint}</test.profitbricks.endpoint> - <test.profitbricks.identity>${test.profitbricks.identity}</test.profitbricks.identity> - <test.profitbricks.credential>${test.profitbricks.credential}</test.profitbricks.credential> - <test.profitbricks.api-version>${test.profitbricks.api-version}</test.profitbricks.api-version> - <test.profitbricks.template>${test.profitbricks.template}</test.profitbricks.template> - </systemPropertyVariables> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> -</project> http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java deleted file mode 100644 index 8755ed9..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java +++ /dev/null @@ -1,64 +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.profitbricks; - -import java.io.Closeable; -import org.jclouds.profitbricks.features.DataCenterApi; -import org.jclouds.profitbricks.features.DrivesApi; -import org.jclouds.profitbricks.features.FirewallApi; -import org.jclouds.profitbricks.features.ImageApi; - -import org.jclouds.profitbricks.features.IpBlockApi; -import org.jclouds.profitbricks.features.LoadBalancerApi; -import org.jclouds.profitbricks.features.NicApi; -import org.jclouds.profitbricks.features.ServerApi; -import org.jclouds.profitbricks.features.SnapshotApi; -import org.jclouds.profitbricks.features.StorageApi; -import org.jclouds.rest.annotations.Delegate; - -public interface ProfitBricksApi extends Closeable { - - @Delegate - DataCenterApi dataCenterApi(); - - @Delegate - ImageApi imageApi(); - - @Delegate - ServerApi serverApi(); - - @Delegate - StorageApi storageApi(); - - @Delegate - NicApi nicApi(); - - @Delegate - FirewallApi firewallApi(); - - @Delegate - SnapshotApi snapshotApi(); - - @Delegate - IpBlockApi ipBlockApi(); - - @Delegate - DrivesApi drivesApi(); - - @Delegate - LoadBalancerApi loadBalancerApi(); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java b/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java deleted file mode 100644 index 2973f4a..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApiMetadata.java +++ /dev/null @@ -1,85 +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.profitbricks; - -import java.net.URI; -import java.util.Properties; - -import org.jclouds.profitbricks.compute.config.ProfitBricksComputeServiceContextModule; -import org.jclouds.profitbricks.config.ProfitBricksHttpApiModule; -import org.jclouds.apis.ApiMetadata; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.profitbricks.config.ProfitBricksHttpApiModule.ProfitBricksHttpCommandExecutorServiceModule; -import org.jclouds.rest.internal.BaseHttpApiMetadata; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * Implementation of {@link ApiMetadata} for ProfitBricks API. - */ -public class ProfitBricksApiMetadata extends BaseHttpApiMetadata<ProfitBricksApi> { - - public ProfitBricksApiMetadata() { - this(new Builder()); - } - - @Override - public Builder toBuilder() { - return new Builder().fromApiMetadata(this); - } - - protected ProfitBricksApiMetadata(Builder builder) { - super(builder); - } - - public static Properties defaultProperties() { - Properties properties = BaseHttpApiMetadata.defaultProperties(); - return properties; - } - - public static class Builder extends BaseHttpApiMetadata.Builder<ProfitBricksApi, Builder> { - - protected Builder() { - id("profitbricks") - .name("ProfitBricks API") - .identityName("API Username") - .credentialName("API Password") - .documentation(URI.create("https://www.profitbricks.com/sites/default/files/profitbricks_api_1_3.pdf")) - .defaultEndpoint("https://api.profitbricks.com/1.3") - .version("1.3") - .view(ComputeServiceContext.class) - .defaultProperties(ProfitBricksApiMetadata.defaultProperties()) - .defaultModules(ImmutableSet.<Class<? extends Module>>of( - ProfitBricksHttpApiModule.class, - ProfitBricksHttpCommandExecutorServiceModule.class, - ProfitBricksComputeServiceContextModule.class - )); - } - - @Override - public ProfitBricksApiMetadata build() { - return new ProfitBricksApiMetadata(this); - } - - @Override - protected Builder self() { - return this; - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java b/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java deleted file mode 100644 index ba8b9d4..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java +++ /dev/null @@ -1,114 +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.profitbricks; - -import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT; -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING; -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED; -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED; -import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES; -import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_INITIAL_PERIOD; -import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_MAX_PERIOD; -import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.TIMEOUT_DATACENTER_AVAILABLE; - -import java.net.URI; -import java.util.Properties; - -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.internal.BaseProviderMetadata; - -import com.google.auto.service.AutoService; - -@AutoService(ProviderMetadata.class) -public class ProfitBricksProviderMetadata extends BaseProviderMetadata { - - public ProfitBricksProviderMetadata(Builder builder) { - super(builder); - } - - public ProfitBricksProviderMetadata() { - super(builder()); - } - - @Override - public Builder toBuilder() { - return builder().fromProviderMetadata(this); - } - - public static Builder builder() { - return new Builder(); - } - - public static Properties defaultProperties() { - Properties properties = ProfitBricksApiMetadata.defaultProperties(); - - properties.setProperty(PROPERTY_REGIONS, "de,us"); - properties.setProperty(PROPERTY_REGION + ".de.zones", "de/fkb,de/fra"); - properties.setProperty(PROPERTY_REGION + ".us.zones", "us/las,us/lasdev"); - properties.setProperty(PROPERTY_ZONES, "de/fkb,de/fra,us/las,us/lasdev"); - properties.setProperty(PROPERTY_ZONE + ".de/fkb." + ISO3166_CODES, "DE-BW"); - properties.setProperty(PROPERTY_ZONE + ".de/fra." + ISO3166_CODES, "DE-HE"); - properties.setProperty(PROPERTY_ZONE + ".us/las." + ISO3166_CODES, "US-NV"); - properties.setProperty(PROPERTY_ZONE + ".us/lasdebv." + ISO3166_CODES, "US-NV"); - - properties.put(TIMEOUT_DATACENTER_AVAILABLE, 30L * 60L); // 30 minutes - properties.put(POLL_INITIAL_PERIOD, 5L); - properties.put(POLL_MAX_PERIOD, 60L); - - properties.put("jclouds.ssh.max-retries", "7"); - properties.put("jclouds.ssh.retry-auth", "true"); - - properties.put(PROPERTY_SO_TIMEOUT, 10 * 60 * 1000); - - // Node might still not be available even after DataCenter is done provisioning - // Use 5-minute timeout by default - properties.put(TIMEOUT_NODE_RUNNING, 5 * 60 * 1000); - properties.put(TIMEOUT_NODE_SUSPENDED, 5 * 60 * 1000); - properties.put(TIMEOUT_NODE_TERMINATED, 5 * 60 * 1000); - - return properties; - } - - public static class Builder extends BaseProviderMetadata.Builder { - - protected Builder() { - id("profitbricks") - .name("ProfitBricks Cloud Compute 2.0") - .homepage(URI.create("http://www.profitbricks.com")) - .console(URI.create("https://my.profitbricks.com/dashboard/dcdr2/")) - .iso3166Codes("DE-BW", "DE-HE", "US-NV") - .linkedServices("profitbricks") - .apiMetadata(new ProfitBricksApiMetadata()) - .defaultProperties(ProfitBricksProviderMetadata.defaultProperties()); - } - - @Override - public ProfitBricksProviderMetadata build() { - return new ProfitBricksProviderMetadata(this); - } - - @Override - public Builder fromProviderMetadata(ProviderMetadata in) { - super.fromProviderMetadata(in); - return this; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.java deleted file mode 100644 index 2b842ff..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/BaseProfitBricksRequestBinder.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.profitbricks.binder; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; - -import javax.ws.rs.core.MediaType; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; - -import com.google.common.base.Strings; - -import org.jclouds.io.MutableContentMetadata; -import org.jclouds.io.payloads.BaseMutableContentMetadata; - -public abstract class BaseProfitBricksRequestBinder<T> implements MapBinder { - - protected final String paramName; - - protected BaseProfitBricksRequestBinder(String paramName) { - this.paramName = checkNotNull(paramName, "Initialize 'paramName' in constructor"); - } - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - checkNotNull(request, "request"); - - Object obj = checkNotNull(postParams.get(paramName), "Param '%s' cannot be null.", paramName); - T payload = (T) obj; - - return createRequest(request, createPayload(payload)); - } - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - throw new UnsupportedOperationException("Not supported yet."); - } - - protected abstract String createPayload(T payload); - - protected static String formatIfNotEmpty(String pattern, Object param) { - return Strings.isNullOrEmpty(nullableToString(param)) ? "" : String.format(pattern, param); - } - - protected static String nullableToString(Object object) { - return object == null ? "" : object.toString(); - } - - protected <R extends HttpRequest> R createRequest(R fromRequest, String payload) { - MutableContentMetadata metadata = new BaseMutableContentMetadata(); - metadata.setContentType(MediaType.TEXT_XML); - metadata.setContentLength(Long.valueOf(payload.getBytes().length)); - - fromRequest.setPayload(payload); - fromRequest.getPayload().setContentMetadata(metadata); - return fromRequest; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java deleted file mode 100644 index 1873f31..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/CreateDataCenterRequestBinder.java +++ /dev/null @@ -1,44 +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.profitbricks.binder.datacenter; - -import static java.lang.String.format; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.DataCenter; - -public class CreateDataCenterRequestBinder extends BaseProfitBricksRequestBinder<DataCenter.Request.CreatePayload> { - - protected final StringBuilder requestBuilder; - - CreateDataCenterRequestBinder() { - super("dataCenter"); - this.requestBuilder = new StringBuilder(128); - } - - @Override - protected String createPayload(DataCenter.Request.CreatePayload payload) { - requestBuilder.append("<ws:createDataCenter>") - .append("<request>") - .append(format("<dataCenterName>%s</dataCenterName>", payload.name())) - .append(format("<location>%s</location>", payload.location().getId())) - .append("</request>") - .append("</ws:createDataCenter>"); - return requestBuilder.toString(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java deleted file mode 100644 index 920e9bf..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/datacenter/UpdateDataCenterRequestBinder.java +++ /dev/null @@ -1,44 +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.profitbricks.binder.datacenter; - -import static java.lang.String.format; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.DataCenter; - -public class UpdateDataCenterRequestBinder extends BaseProfitBricksRequestBinder<DataCenter.Request.UpdatePayload> { - - protected final StringBuilder requestBuilder; - - UpdateDataCenterRequestBinder() { - super("dataCenter"); - this.requestBuilder = new StringBuilder(128); - } - - @Override - protected String createPayload(DataCenter.Request.UpdatePayload payload) { - requestBuilder.append("<ws:updateDataCenter>") - .append("<request>") - .append(format("<dataCenterId>%s</dataCenterId>", payload.id())) - .append(format("<dataCenterName>%s</dataCenterName>", payload.name())) - .append("</request>") - .append("</ws:updateDataCenter>"); - return requestBuilder.toString(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java deleted file mode 100644 index 3a931ab..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/drive/AddRomDriveToServerRequestBinder.java +++ /dev/null @@ -1,45 +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.profitbricks.binder.drive; - -import static java.lang.String.format; -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Drive; - -public class AddRomDriveToServerRequestBinder extends BaseProfitBricksRequestBinder<Drive.Request.AddRomDriveToServerPayload> { - - private final StringBuilder requestBuilder; - - AddRomDriveToServerRequestBinder() { - super("payload"); - this.requestBuilder = new StringBuilder(128); - } - - @Override - protected String createPayload(Drive.Request.AddRomDriveToServerPayload payload) { - requestBuilder.append("<ws:addRomDriveToServer>") - .append("<request>") - .append(format("<imageId>%s</imageId>", payload.imageId())) - .append(format("<serverId>%s</serverId>", payload.serverId())) - .append(formatIfNotEmpty("<deviceNumber>%s</deviceNumber>", payload.deviceNumber())) - .append("</request>") - .append("</ws:addRomDriveToServer>"); - - return requestBuilder.toString(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java deleted file mode 100644 index 8f4db03..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/AddFirewallRuleToNicRequestBinder.java +++ /dev/null @@ -1,53 +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.profitbricks.binder.firewall; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Firewall; -import static java.lang.String.format; - -public class AddFirewallRuleToNicRequestBinder extends BaseProfitBricksRequestBinder<Firewall.Request.AddRulePayload> { - - private final StringBuilder requestBuilder; - - AddFirewallRuleToNicRequestBinder() { - super("firewall"); - this.requestBuilder = new StringBuilder(128); - } - - @Override - protected String createPayload(Firewall.Request.AddRulePayload payload) { - requestBuilder.append("<ws:addFirewallRulesToNic>") - .append(format("<nicId>%s</nicId>", payload.nicId())); - for (Firewall.Rule rule : payload.rules()) - requestBuilder - .append("<request>") - .append(formatIfNotEmpty("<icmpCode>%s</icmpCode>", rule.icmpCode())) - .append(formatIfNotEmpty("<icmpType>%s</icmpType>", rule.icmpType())) - .append(formatIfNotEmpty("<name>%s</name>", rule.name())) - .append(formatIfNotEmpty("<portRangeEnd>%s</portRangeEnd>", rule.portRangeEnd())) - .append(formatIfNotEmpty("<portRangeStart>%s</portRangeStart>", rule.portRangeStart())) - .append(formatIfNotEmpty("<protocol>%s</protocol>", rule.protocol())) - .append(formatIfNotEmpty("<sourceIp>%s</sourceIp>", rule.sourceIp())) - .append(formatIfNotEmpty("<sourceMac>%s</sourceMac>", rule.sourceMac())) - .append(formatIfNotEmpty("<targetIp>%s</targetIp>", rule.targetIp())) - .append("</request>"); - requestBuilder.append("</ws:addFirewallRulesToNic>"); - return requestBuilder.toString(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java deleted file mode 100644 index a1f03c2..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/firewall/FirewallBinder.java +++ /dev/null @@ -1,95 +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.profitbricks.binder.firewall; - -import static java.lang.String.format; - -import java.util.List; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; - -import com.google.common.base.Strings; - -public abstract class FirewallBinder extends BaseProfitBricksRequestBinder<List<String>> { - - protected final StringBuilder requestBuilder; - - FirewallBinder() { - super("ids"); - this.requestBuilder = new StringBuilder(128); - } - - protected void bindListWithTag(List<String> ids, String tag) { - if (ids == null || ids.isEmpty() || Strings.isNullOrEmpty(tag)) - return; - for (String id : ids) - requestBuilder.append(format("<%s>%s</%s>", tag, id, tag)); - } - - public static class ActivateFirewallRequestBinder extends FirewallBinder { - - @Override - protected String createPayload(List<String> payload) { - requestBuilder.append("<ws:activateFirewalls>"); - bindListWithTag(payload, "firewallIds"); - requestBuilder.append("</ws:activateFirewalls>"); - - return requestBuilder.toString(); - } - - } - - public static class DeactivateFirewallRequestBinder extends FirewallBinder { - - @Override - protected String createPayload(List<String> payload) { - requestBuilder.append("<ws:deactivateFirewalls>"); - bindListWithTag(payload, "firewallIds"); - requestBuilder.append("</ws:deactivateFirewalls>"); - - return requestBuilder.toString(); - } - - } - - public static class DeleteFirewallRequestBinder extends FirewallBinder { - - @Override - protected String createPayload(List<String> payload) { - requestBuilder.append("<ws:deleteFirewalls>"); - bindListWithTag(payload, "firewallIds"); - requestBuilder.append("</ws:deleteFirewalls>"); - - return requestBuilder.toString(); - } - - } - - public static class RemoveFirewallRuleRequestBinder extends FirewallBinder { - - @Override - protected String createPayload(List<String> payload) { - requestBuilder.append("<ws:removeFirewallRules>"); - bindListWithTag(payload, "firewallRuleIds"); - requestBuilder.append("</ws:removeFirewallRules>"); - - return requestBuilder.toString(); - } - - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java deleted file mode 100644 index e3d13a1..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.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.profitbricks.binder.loadbalancer; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.LoadBalancer; - -import static java.lang.String.format; - -public class CreateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.CreatePayload> { - - protected final StringBuilder requestBuilder; - - CreateLoadBalancerRequestBinder() { - super("loadbalancer"); - this.requestBuilder = new StringBuilder(128 * 4); - } - - @Override - protected String createPayload(LoadBalancer.Request.CreatePayload payload) { - requestBuilder.append("<ws:createLoadBalancer>") - .append("<request>") - .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) - .append(format("<loadBalancerName>%s</loadBalancerName>", payload.name())) - .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm())) - .append(format("<ip>%s</ip>", payload.ip())) - .append(format("<lanId>%s</lanId>", payload.lanId())); - for (String serverId : payload.serverIds()) - requestBuilder.append(format("<serverIds>%s</serverIds>", serverId)); - requestBuilder - .append("</request>") - .append("</ws:createLoadBalancer>"); - - return requestBuilder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java deleted file mode 100644 index 086fa3d..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java +++ /dev/null @@ -1,42 +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.profitbricks.binder.loadbalancer; - -import static java.lang.String.format; -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.LoadBalancer; - -public class DeregisterLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.DeregisterPayload> { - - protected final StringBuilder requestBuilder; - - DeregisterLoadBalancerRequestBinder() { - super("loadbalancer"); - this.requestBuilder = new StringBuilder(128 * 4); - } - - @Override - protected String createPayload(LoadBalancer.Request.DeregisterPayload payload) { - requestBuilder.append("<ws:deregisterServersOnLoadBalancer>"); - for (String s : payload.serverIds()) - requestBuilder.append(format("<serverIds>%s</serverIds>", s)); - requestBuilder.append(format("<loadBalancerId>%s</loadBalancerId>", payload.id())) - .append("</ws:deregisterServersOnLoadBalancer>"); - - return requestBuilder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java deleted file mode 100644 index 3741dad..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java +++ /dev/null @@ -1,44 +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.profitbricks.binder.loadbalancer; - -import static java.lang.String.format; -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.LoadBalancer; - -public class RegisterLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.RegisterPayload> { - - protected final StringBuilder requestBuilder; - - RegisterLoadBalancerRequestBinder() { - super("loadbalancer"); - this.requestBuilder = new StringBuilder(128 * 4); - } - - @Override - protected String createPayload(LoadBalancer.Request.RegisterPayload payload) { - requestBuilder - .append("<ws:registerServersOnLoadBalancer>") - .append(format("<loadBalancerId>%s</loadBalancerId>", payload.id())); - - for (String s : payload.serverIds()) - requestBuilder.append(format("<serverIds>%s</serverIds>", s)); - requestBuilder.append("</ws:registerServersOnLoadBalancer>"); - - return requestBuilder.toString().replaceAll("\\s+", ""); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java deleted file mode 100644 index c093f23..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java +++ /dev/null @@ -1,44 +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.profitbricks.binder.loadbalancer; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.LoadBalancer; - -import static java.lang.String.format; - -public class UpdateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.UpdatePayload> { - - protected final StringBuilder requestBuilder; - - UpdateLoadBalancerRequestBinder() { - super("loadbalancer"); - this.requestBuilder = new StringBuilder(128 * 4); - } - - @Override - protected String createPayload(LoadBalancer.Request.UpdatePayload payload) { - return requestBuilder.append("<ws:updateLoadBalancer>") - .append("<request>") - .append(format("<loadBalancerId>%s</loadBalancerId>", payload.id())) - .append(formatIfNotEmpty("<loadBalancerName>%s</loadBalancerName>", payload.name())) - .append(formatIfNotEmpty("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm())) - .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) - .append("</request>") - .append("</ws:updateLoadBalancer>").toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.java deleted file mode 100644 index f7dbdb3..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/CreateNicRequestBinder.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.profitbricks.binder.nic; - -import static java.lang.String.format; -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Nic; - -public class CreateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.CreatePayload> { - - private final StringBuilder requestBuilder; - - CreateNicRequestBinder() { - super("nic"); - this.requestBuilder = new StringBuilder(128 * 2); - } - - @Override - protected String createPayload(Nic.Request.CreatePayload payload) { - requestBuilder.append("<ws:createNic>") - .append("<request>") - .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) - .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name())) - .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive())) - .append(format("<serverId>%s</serverId>", payload.serverId())) - .append(format("<lanId>%s</lanId>", payload.lanId())) - .append("</request>") - .append("</ws:createNic>"); - return requestBuilder.toString(); - - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java deleted file mode 100644 index acdc809..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/SetInternetAccessBinder.java +++ /dev/null @@ -1,42 +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.profitbricks.binder.nic; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Nic; - -import static java.lang.String.format; - -public class SetInternetAccessBinder extends BaseProfitBricksRequestBinder<Nic.Request.SetInternetAccessPayload> { - - private final StringBuilder requestBuilder; - - SetInternetAccessBinder() { - super("nic"); - this.requestBuilder = new StringBuilder(128); - } - - @Override - protected String createPayload(Nic.Request.SetInternetAccessPayload payload) { - requestBuilder.append("<ws:setInternetAccess>") - .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) - .append(format("<lanId>%s</lanId>", payload.lanId())) - .append(format("<internetAccess>%s</internetAccess>", payload.internetAccess())) - .append("</ws:setInternetAccess>"); - return requestBuilder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.java deleted file mode 100644 index f1e9d83..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/nic/UpdateNicRequestBinder.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.profitbricks.binder.nic; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Nic; - -import static java.lang.String.format; - -public class UpdateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.UpdatePayload> { - - private final StringBuilder requestBuilder; - - UpdateNicRequestBinder() { - super("nic"); - this.requestBuilder = new StringBuilder(128 * 2); - } - - @Override - protected String createPayload(Nic.Request.UpdatePayload payload) { - requestBuilder.append("<ws:updateNic>") - .append("<request>") - .append(format("<nicId>%s</nicId>", payload.id())) - .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) - .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name())) - .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive())) - .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId())) - .append("</request>") - .append("</ws:updateNic>"); - return requestBuilder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java deleted file mode 100644 index b836ceb..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/CreateServerRequestBinder.java +++ /dev/null @@ -1,57 +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.profitbricks.binder.server; - -import static java.lang.String.format; -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Server; - -public class CreateServerRequestBinder extends BaseProfitBricksRequestBinder<Server.Request.CreatePayload> { - - protected final StringBuilder requestBuilder; - - CreateServerRequestBinder() { - super("server"); - this.requestBuilder = new StringBuilder(128 * 4); - } - - @Override - protected String createPayload(Server.Request.CreatePayload payload) { - requestBuilder.append("<ws:createServer>") - .append("<request>") - .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) - .append(format("<cores>%s</cores>", payload.cores())) - .append(format("<ram>%s</ram>", payload.ram())) - .append(formatIfNotEmpty("<serverName>%s</serverName>", payload.name())) - .append(formatIfNotEmpty("<bootFromStorageId>%s</bootFromStorageId>", payload.bootFromStorageId())) - .append(formatIfNotEmpty("<bootFromImageId>%s</bootFromImageId>", payload.bootFromImageId())) - .append(formatIfNotEmpty("<internetAccess>%s</internetAccess>", payload.hasInternetAccess())) - .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId())) - .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType())) - .append(formatIfNotEmpty("<availabilityZone>%s</availabilityZone>", payload.availabilityZone())) - .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug())) - .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug())) - .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug())) - .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug())) - .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug())) - .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug())) - .append("</request>") - .append("</ws:createServer>"); - return requestBuilder.toString(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java deleted file mode 100644 index c12ae21..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/server/UpdateServerRequestBinder.java +++ /dev/null @@ -1,56 +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.profitbricks.binder.server; - -import static java.lang.String.format; -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Server; - -public class UpdateServerRequestBinder extends BaseProfitBricksRequestBinder<Server.Request.UpdatePayload> { - - protected final StringBuilder requestBuilder; - - UpdateServerRequestBinder() { - super("server"); - this.requestBuilder = new StringBuilder(128 * 4); - - } - - @Override - protected String createPayload(Server.Request.UpdatePayload payload) { - requestBuilder.append("<ws:updateServer>") - .append("<request>") - .append(format("<serverId>%s</serverId>", payload.id())) - .append(format("<cores>%s</cores>", payload.cores())) - .append(format("<ram>%s</ram>", payload.ram())) - .append(formatIfNotEmpty("<serverName>%s</serverName>", payload.name())) - .append(formatIfNotEmpty("<bootFromStorageId>%s</bootFromStorageId>", payload.bootFromStorageId())) - .append(formatIfNotEmpty("<bootFromImageId>%s</bootFromImageId>", payload.bootFromImageId())) - .append(formatIfNotEmpty("<osType>%s</osType>", payload.osType())) - .append(formatIfNotEmpty("<availabilityZone>%s</availabilityZone>", payload.availabilityZone())) - .append(formatIfNotEmpty("<cpuHotPlug>%s</cpuHotPlug>", payload.isCpuHotPlug())) - .append(formatIfNotEmpty("<ramHotPlug>%s</ramHotPlug>", payload.isRamHotPlug())) - .append(formatIfNotEmpty("<nicHotPlug>%s</nicHotPlug>", payload.isNicHotPlug())) - .append(formatIfNotEmpty("<nicHotUnPlug>%s</nicHotUnPlug>", payload.isNicHotUnPlug())) - .append(formatIfNotEmpty("<discVirtioHotPlug>%s</discVirtioHotPlug>", payload.isDiscVirtioHotPlug())) - .append(formatIfNotEmpty("<discVirtioHotUnPlug>%s</discVirtioHotUnPlug>", payload.isDiscVirtioHotUnPlug())) - .append("</request>") - .append("</ws:updateServer>"); - return requestBuilder.toString(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java deleted file mode 100644 index 5ec4644..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/CreateSnapshotRequestBinder.java +++ /dev/null @@ -1,44 +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.profitbricks.binder.snapshot; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Snapshot; - -import static java.lang.String.format; - -public class CreateSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.CreatePayload> { - - protected final StringBuilder requestBuilder; - - protected CreateSnapshotRequestBinder() { - super("snapshot"); - this.requestBuilder = new StringBuilder(128); - } - - @Override - protected String createPayload(Snapshot.Request.CreatePayload payload) { - requestBuilder.append("<ws:createSnapshot>") - .append("<request>") - .append(format("<storageId>%s</storageId>", payload.storageId())) - .append(formatIfNotEmpty("<description>%s</description>", payload.description())) - .append(formatIfNotEmpty("<snapshotName>%s</snapshotName>", payload.name())) - .append("</request>") - .append("</ws:createSnapshot>"); - return requestBuilder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.java ---------------------------------------------------------------------- diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.java deleted file mode 100644 index 5099324..0000000 --- a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/snapshot/RollbackSnapshotRequestBinder.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.profitbricks.binder.snapshot; - -import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder; -import org.jclouds.profitbricks.domain.Snapshot; - -import static java.lang.String.format; - -public class RollbackSnapshotRequestBinder extends BaseProfitBricksRequestBinder<Snapshot.Request.RollbackPayload> { - - protected final StringBuilder requestBuilder; - - protected RollbackSnapshotRequestBinder() { - super("snapshot"); - this.requestBuilder = new StringBuilder(128); - } - - @Override - protected String createPayload(Snapshot.Request.RollbackPayload payload) { - requestBuilder.append("<ws:rollbackSnapshot>") - .append("<request>") - .append(format("<snapshotId>%s</snapshotId>", payload.snapshotId())) - .append(format("<storageId>%s</storageId>", payload.storageId())) - .append("</request>") - .append("</ws:rollbackSnapshot>"); - return requestBuilder.toString(); - } -}
