You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/24 06:05:20 UTC
[3/3] git commit: In latest Azure api,
there are both OS images and Disk images.
In latest Azure api, there are both OS images and Disk images.
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/7f307e85
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/7f307e85
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/7f307e85
Branch: refs/heads/master
Commit: 7f307e85982383202bf8b53a8ae18e14bc52207e
Parents: 3b4c652
Author: Adrian Cole <ac...@twitter.com>
Authored: Wed Oct 22 21:03:10 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Thu Oct 23 21:05:09 2014 -0700
----------------------------------------------------------------------
.../jclouds/azurecompute/AzureComputeApi.java | 5 +-
.../AzureComputeProviderMetadata.java | 5 +-
.../AzureManagementApiMetadata.java | 8 +-
.../binders/DeploymentParamsToXML.java | 8 +-
.../azurecompute/binders/ImageParamsToXML.java | 43 -----
.../binders/OSImageParamsToXML.java | 43 +++++
.../compute/AzureComputeServiceAdapter.java | 9 +-
.../AzureComputeServiceContextModule.java | 17 +-
.../compute/functions/AzureImageToImage.java | 29 ---
.../functions/DeploymentToNodeMetadata.java | 3 +-
.../compute/functions/OSImageToImage.java | 30 +++
.../compute/functions/RoleSizeToHardware.java | 3 +-
.../config/AzureComputeHttpApiModule.java | 7 +-
.../azurecompute/domain/DeploymentParams.java | 20 +-
.../org/jclouds/azurecompute/domain/Disk.java | 9 +-
.../org/jclouds/azurecompute/domain/Image.java | 183 -------------------
.../azurecompute/domain/ImageParams.java | 141 --------------
.../jclouds/azurecompute/domain/OSImage.java | 176 ++++++++++++++++++
.../azurecompute/domain/OSImageParams.java | 139 ++++++++++++++
.../jclouds/azurecompute/features/DiskApi.java | 8 +-
.../jclouds/azurecompute/features/ImageApi.java | 101 ----------
.../azurecompute/features/LocationApi.java | 6 +-
.../azurecompute/features/OSImageApi.java | 101 ++++++++++
.../azurecompute/features/OperationApi.java | 5 +-
.../features/VirtualMachineApi.java | 9 +-
.../azurecompute/functions/ImageParamsName.java | 27 ---
.../functions/OSImageParamsName.java | 27 +++
.../functions/ParseRequestIdHeader.java | 6 +-
.../suppliers/KeyStoreSupplier.java | 13 +-
.../suppliers/SSLContextWithKeysSupplier.java | 9 +-
.../jclouds/azurecompute/xml/DiskHandler.java | 6 +-
.../jclouds/azurecompute/xml/ImageHandler.java | 109 -----------
.../azurecompute/xml/ListImagesHandler.java | 61 -------
.../azurecompute/xml/ListOSImagesHandler.java | 61 +++++++
.../azurecompute/xml/OSImageHandler.java | 113 ++++++++++++
.../features/DeploymentApiMockTest.java | 12 +-
.../azurecompute/features/DiskApiLiveTest.java | 6 +-
.../azurecompute/features/ImageApiLiveTest.java | 84 ---------
.../azurecompute/features/ImageApiMockTest.java | 132 -------------
.../features/LocationApiMockTest.java | 7 +-
.../features/OSImageApiLiveTest.java | 83 +++++++++
.../features/OSImageApiMockTest.java | 132 +++++++++++++
.../features/VirtualMachineApiMockTest.java | 7 +-
.../internal/BaseAzureComputeApiLiveTest.java | 5 +-
.../internal/BaseAzureComputeApiMockTest.java | 22 ++-
.../azurecompute/xml/ListDisksHandlerTest.java | 6 +-
.../azurecompute/xml/ListImagesHandlerTest.java | 157 ----------------
.../xml/ListOSImagesHandlerTest.java | 158 ++++++++++++++++
.../src/test/resources/capturerolepayload.xml | 2 +-
azurecompute/src/test/resources/images.xml | 1 +
.../src/test/resources/restartrolepayload.xml | 2 +-
.../src/test/resources/shutdownrolepayload.xml | 2 +-
.../src/test/resources/startrolepayload.xml | 2 +-
53 files changed, 1192 insertions(+), 1168 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/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
index ec037a3..5946838 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeApi.java
@@ -17,13 +17,14 @@
package org.jclouds.azurecompute;
import java.io.Closeable;
+
import javax.ws.rs.PathParam;
import org.jclouds.azurecompute.features.CloudServiceApi;
import org.jclouds.azurecompute.features.DeploymentApi;
import org.jclouds.azurecompute.features.DiskApi;
-import org.jclouds.azurecompute.features.ImageApi;
import org.jclouds.azurecompute.features.LocationApi;
+import org.jclouds.azurecompute.features.OSImageApi;
import org.jclouds.azurecompute.features.OperationApi;
import org.jclouds.azurecompute.features.VirtualMachineApi;
import org.jclouds.rest.annotations.Delegate;
@@ -81,7 +82,7 @@ public interface AzureComputeApi extends Closeable {
* @see <a href="http://msdn.microsoft.com/en-us/library/jj157175">docs</a>
*/
@Delegate
- ImageApi getImageApi();
+ OSImageApi getOSImageApi();
/**
* The Service Management API includes operations for Tracking Asynchronous Service Management
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/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
index 8fcb560..9c811ce 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeProviderMetadata.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureComputeProviderMetadata.java
@@ -16,13 +16,14 @@
*/
package org.jclouds.azurecompute;
+import static org.jclouds.azurecompute.config.AzureComputeProperties.SUBSCRIPTION_ID;
+
import java.net.URI;
import java.util.Properties;
+
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
-import static org.jclouds.azurecompute.config.AzureComputeProperties.SUBSCRIPTION_ID;
-
/**
* Implementation of {@link ProviderMetadata} for Microsoft Azure Service Management Service.
*/
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/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
index 762261c..0caad94 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/AzureManagementApiMetadata.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/AzureManagementApiMetadata.java
@@ -16,16 +16,18 @@
*/
package org.jclouds.azurecompute;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
+import static org.jclouds.azurecompute.config.AzureComputeProperties.SUBSCRIPTION_ID;
+
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.rest.internal.BaseHttpApiMetadata;
-import static org.jclouds.azurecompute.config.AzureComputeProperties.SUBSCRIPTION_ID;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
/**
* Implementation of {@link ApiMetadata} for Microsoft Service Management Service API
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/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
index c493c90..26301d6 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/DeploymentParamsToXML.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/DeploymentParamsToXML.java
@@ -19,10 +19,10 @@ package org.jclouds.azurecompute.binders;
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static com.google.common.base.Throwables.propagate;
-import static org.jclouds.azurecompute.domain.Image.OSType.LINUX;
+import static org.jclouds.azurecompute.domain.OSImage.Type.LINUX;
import org.jclouds.azurecompute.domain.DeploymentParams;
-import org.jclouds.azurecompute.domain.Image.OSType;
+import org.jclouds.azurecompute.domain.OSImage;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.Binder;
@@ -44,7 +44,7 @@ public final class DeploymentParamsToXML implements Binder {
.e("RoleType").t("PersistentVMRole").up()
.e("ConfigurationSets");
- if (params.os() == OSType.WINDOWS) {
+ if (params.os() == OSImage.Type.WINDOWS) {
XMLBuilder configBuilder = builder.e("ConfigurationSet"); // Windows
configBuilder.e("ConfigurationSetType").t("WindowsProvisioningConfiguration").up()
.e("ComputerName").t(params.name()).up()
@@ -61,7 +61,7 @@ public final class DeploymentParamsToXML implements Binder {
.up() // Domain Join
.e("StoredCertificateSettings").up()
.up(); // Windows ConfigurationSet
- } else if (params.os() == OSType.LINUX) {
+ } else if (params.os() == OSImage.Type.LINUX) {
XMLBuilder configBuilder = builder.e("ConfigurationSet"); // Linux
configBuilder.e("ConfigurationSetType").t("LinuxProvisioningConfiguration").up()
.e("HostName").t(params.name()).up()
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ImageParamsToXML.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ImageParamsToXML.java b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ImageParamsToXML.java
deleted file mode 100644
index 040184b..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/binders/ImageParamsToXML.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.azurecompute.binders;
-
-import static com.google.common.base.Throwables.propagate;
-import static org.jclouds.azurecompute.domain.Image.OSType.LINUX;
-
-import org.jclouds.azurecompute.domain.ImageParams;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.Binder;
-
-import com.jamesmurty.utils.XMLBuilder;
-
-public final class ImageParamsToXML implements Binder {
- @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- ImageParams params = ImageParams.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/7f307e85/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
new file mode 100644
index 0000000..3d87c8f
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/binders/OSImageParamsToXML.java
@@ -0,0 +1,43 @@
+/*
+ * 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 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/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
index 4ce0ee4..9663a75 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
@@ -17,9 +17,10 @@
package org.jclouds.azurecompute.compute;
import javax.inject.Singleton;
+
import org.jclouds.azurecompute.AzureComputeApi;
import org.jclouds.azurecompute.domain.Deployment;
-import org.jclouds.azurecompute.domain.Image;
+import org.jclouds.azurecompute.domain.OSImage;
import org.jclouds.azurecompute.domain.RoleSize;
import org.jclouds.compute.ComputeServiceAdapter;
import org.jclouds.compute.domain.Template;
@@ -29,7 +30,7 @@ import org.jclouds.compute.domain.Template;
* jclouds {@link org.jclouds.compute.ComputeService}
*/
@Singleton
-public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Deployment, RoleSize, Image, String> {
+public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Deployment, RoleSize, OSImage, String> {
@Override
public NodeAndInitialCredentials<Deployment> createNodeWithGroupEncodedIntoName(
@@ -45,13 +46,13 @@ public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Deploym
}
@Override
- public Iterable<Image> listImages() {
+ public Iterable<OSImage> listImages() {
// TODO Auto-generated method stub
return null;
}
@Override
- public Image getImage(String id) {
+ public OSImage getImage(String id) {
// TODO Auto-generated method stub
return null;
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/compute/config/AzureComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/config/AzureComputeServiceContextModule.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/config/AzureComputeServiceContextModule.java
index 2edd8a0..b09b867 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/config/AzureComputeServiceContextModule.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/config/AzureComputeServiceContextModule.java
@@ -16,30 +16,31 @@
*/
package org.jclouds.azurecompute.compute.config;
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
import org.jclouds.azurecompute.compute.AzureComputeServiceAdapter;
-import org.jclouds.azurecompute.compute.functions.AzureImageToImage;
import org.jclouds.azurecompute.compute.functions.DeploymentToNodeMetadata;
+import org.jclouds.azurecompute.compute.functions.OSImageToImage;
import org.jclouds.azurecompute.compute.functions.RoleSizeToHardware;
import org.jclouds.azurecompute.domain.Deployment;
-import org.jclouds.azurecompute.domain.Image;
+import org.jclouds.azurecompute.domain.OSImage;
import org.jclouds.azurecompute.domain.RoleSize;
import org.jclouds.compute.ComputeServiceAdapter;
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.NodeMetadata;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+
public class AzureComputeServiceContextModule
- extends ComputeServiceAdapterContextModule<Deployment, RoleSize, Image, String> {
+ extends ComputeServiceAdapterContextModule<Deployment, RoleSize, OSImage, String> {
@Override
protected void configure() {
super.configure();
- bind(new TypeLiteral<ComputeServiceAdapter<Deployment, RoleSize, Image, String>>() {
+ bind(new TypeLiteral<ComputeServiceAdapter<Deployment, RoleSize, OSImage, String>>() {
}).to(AzureComputeServiceAdapter.class);
- bind(new TypeLiteral<Function<Image, org.jclouds.compute.domain.Image>>() {
- }).to(AzureImageToImage.class);
+ bind(new TypeLiteral<Function<OSImage, org.jclouds.compute.domain.Image>>() {
+ }).to(OSImageToImage.class);
bind(new TypeLiteral<Function<RoleSize, Hardware>>() {
}).to(RoleSizeToHardware.class);
bind(new TypeLiteral<Function<Deployment, NodeMetadata>>() {
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/AzureImageToImage.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/AzureImageToImage.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/AzureImageToImage.java
deleted file mode 100644
index 4da1c34..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/AzureImageToImage.java
+++ /dev/null
@@ -1,29 +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.compute.functions;
-
-import com.google.common.base.Function;
-import org.jclouds.azurecompute.domain.Image;
-
-public class AzureImageToImage implements Function<Image, org.jclouds.compute.domain.Image> {
-
- @Override
- public org.jclouds.compute.domain.Image apply(Image input) {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/DeploymentToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/DeploymentToNodeMetadata.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/DeploymentToNodeMetadata.java
index 7e02ee6..127ea02 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/DeploymentToNodeMetadata.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/DeploymentToNodeMetadata.java
@@ -16,10 +16,11 @@
*/
package org.jclouds.azurecompute.compute.functions;
-import com.google.common.base.Function;
import org.jclouds.azurecompute.domain.Deployment;
import org.jclouds.compute.domain.NodeMetadata;
+import com.google.common.base.Function;
+
public class DeploymentToNodeMetadata implements Function<Deployment, NodeMetadata> {
@Override
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
new file mode 100644
index 0000000..9cd1e70
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/OSImageToImage.java
@@ -0,0 +1,30 @@
+/*
+ * 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.compute.functions;
+
+import org.jclouds.azurecompute.domain.OSImage;
+import org.jclouds.compute.domain.Image;
+
+import com.google.common.base.Function;
+
+public class OSImageToImage implements Function<OSImage, Image> {
+
+ @Override
+ public Image apply(OSImage input) {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
index 09dbf78..97a9b2c 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/functions/RoleSizeToHardware.java
@@ -16,10 +16,11 @@
*/
package org.jclouds.azurecompute.compute.functions;
-import com.google.common.base.Function;
import org.jclouds.azurecompute.domain.RoleSize;
import org.jclouds.compute.domain.Hardware;
+import com.google.common.base.Function;
+
public class RoleSizeToHardware implements Function<RoleSize, Hardware> {
@Override
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
index 8c85c0a..2d07471 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/config/AzureComputeHttpApiModule.java
@@ -16,16 +16,19 @@
*/
package org.jclouds.azurecompute.config;
-import com.google.common.base.Supplier;
-import com.google.inject.TypeLiteral;
import java.security.KeyStore;
+
import javax.net.ssl.SSLContext;
+
import org.jclouds.azurecompute.AzureComputeApi;
import org.jclouds.azurecompute.suppliers.KeyStoreSupplier;
import org.jclouds.azurecompute.suppliers.SSLContextWithKeysSupplier;
import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule;
+import com.google.common.base.Supplier;
+import com.google.inject.TypeLiteral;
+
@ConfiguresHttpApi
public class AzureComputeHttpApiModule extends HttpApiModule<AzureComputeApi> {
@Override
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
index ac06305..e75fa19 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/DeploymentParams.java
@@ -24,8 +24,6 @@ import java.net.URI;
import java.util.Collection;
import java.util.List;
-import org.jclouds.azurecompute.domain.Image.OSType;
-
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
@@ -134,18 +132,18 @@ public final class DeploymentParams {
return password;
}
- /** {@link Image#name() name} of the user or platform image. */
+ /** {@link OSImage#name() name} of the user or platform image. */
public String sourceImageName() {
return sourceImageName;
}
- /** Indicates the {@link Image#mediaLink() location} when {@link #sourceImageName() source} is a platform image. */
+ /** Indicates the {@link OSImage#mediaLink() location} when {@link #sourceImageName() source} is a platform image. */
public URI mediaLink() {
return mediaLink;
}
- /** {@link Image#os() Os type} of the {@link #sourceImageName() source image}. */
- public OSType os() {
+ /** {@link OSImage#os() Os type} of the {@link #sourceImageName() source image}. */
+ public OSImage.Type os() {
return os;
}
@@ -168,7 +166,7 @@ public final class DeploymentParams {
private String password;
private String sourceImageName;
private URI mediaLink;
- private OSType os;
+ private OSImage.Type os;
private List<ExternalEndpoint> externalEndpoints = Lists.newArrayList();
public Builder name(String name) {
@@ -201,7 +199,7 @@ public final class DeploymentParams {
return this;
}
- public Builder os(OSType os) {
+ public Builder os(OSImage.Type os) {
this.os = os;
return this;
}
@@ -234,13 +232,13 @@ public final class DeploymentParams {
}
private static DeploymentParams create(String name, RoleSize size, String username, String password, String sourceImageName,
- URI mediaLink, OSType os, List<ExternalEndpoint> externalEndpoints) {
+ URI mediaLink, OSImage.Type os, List<ExternalEndpoint> externalEndpoints) {
return new DeploymentParams(name, size, username, password, sourceImageName, mediaLink, os, externalEndpoints);
}
// TODO: Remove from here down with @AutoValue.
private DeploymentParams(String name, RoleSize size, String username, String password, String sourceImageName, URI mediaLink,
- OSType os, List<ExternalEndpoint> externalEndpoints) {
+ OSImage.Type os, List<ExternalEndpoint> externalEndpoints) {
this.name = checkNotNull(name, "name");
this.size = checkNotNull(size, "size");
this.username = checkNotNull(username, "username");
@@ -257,7 +255,7 @@ public final class DeploymentParams {
private final String password;
private final String sourceImageName;
private final URI mediaLink;
- private final OSType os;
+ private final OSImage.Type os;
private final List<ExternalEndpoint> externalEndpoints;
@Override public int hashCode() {
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
index 07ebf56..888e9af 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Disk.java
@@ -22,7 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
-import org.jclouds.azurecompute.domain.Image.OSType;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
@@ -126,7 +125,7 @@ public final class Disk {
}
/** The operating system type of the OS image, or null if a data disk. */
- @Nullable public OSType os() {
+ @Nullable public OSImage.Type os() {
return os;
}
@@ -165,13 +164,13 @@ public final class Disk {
}
public static Disk create(String name, String location, String affinityGroup, String description,
- OSType os, URI mediaLink, Integer logicalSizeInGB, Attachment attachedTo, String sourceImage) {
+ OSImage.Type os, URI mediaLink, Integer logicalSizeInGB, Attachment attachedTo, String sourceImage) {
return new Disk(name, location, affinityGroup, description, os, mediaLink, logicalSizeInGB, attachedTo,
sourceImage);
}
// TODO: Remove from here down with @AutoValue.
- private Disk(String name, String location, String affinityGroup, String description, OSType os, URI mediaLink,
+ private Disk(String name, String location, String affinityGroup, String description, OSImage.Type os, URI mediaLink,
Integer logicalSizeInGB, Attachment attachedTo, String sourceImage) {
this.name = checkNotNull(name, "name");
this.location = location;
@@ -188,7 +187,7 @@ public final class Disk {
private final String location;
private final String affinityGroup;
private final String description;
- private final OSType os;
+ private final OSImage.Type os;
private final URI mediaLink;
private final Integer logicalSizeInGB;
private final Attachment attachedTo;
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Image.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Image.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Image.java
deleted file mode 100644
index d533c41..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/Image.java
+++ /dev/null
@@ -1,183 +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.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.List;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-
-/**
- * OS image from the image repository
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/jj157191" >api</a>
- */
-public final class Image {
- public enum OSType {
- LINUX, WINDOWS;
- }
-
- public String name() {
- return name;
- }
-
- /**
- * The geo-location of the image in Windows Azure, if the image is not
- * associated with an affinity group. If a location has been specified, the AffinityGroup element
- * is not returned.
- */
- @Nullable public String location() {
- return location;
- }
-
- /**
- * The affinity group with which this image is associated, if any. If the service is
- * associated with an affinity group, the Location element is not returned.
- */
- @Nullable public String affinityGroup() {
- return affinityGroup;
- }
-
- /**
- * The name can be up to 100 characters in length. The name can be used identify the storage account for your
- * tracking purposes.
- */
- public String label() {
- return label;
- }
-
- @Nullable public String description() {
- return description;
- }
-
- /**
- * The repository classification of image. All user images have the category "User", but
- * categories for other images could be, for example "Canonical"
- */
- @Nullable public String category() {
- return category;
- }
-
- /** The operating system type of the OS image. */
- public OSType os() {
- return os;
- }
-
- /**
- * The location of the blob in the blob store in which the media for the image is located. The
- * blob location belongs to a storage account in the subscription specified by the
- * <subscription-id> value in the operation call.
- *
- * Example:
- *
- * http://example.blob.core.windows.net/disks/myimage.vhd
- */
- @Nullable public URI mediaLink() {
- return mediaLink;
- }
-
- public int logicalSizeInGB() {
- return logicalSizeInGB;
- }
-
- /** The eulas for the image, if available. */
- // Not URI as some providers put non-uri data in, such as riverbed.
- public List<String> eula() {
- return eula;
- }
-
- public static Image create(String name, String location, String affinityGroup, String label, String description,
- String category, OSType os, URI mediaLink, int logicalSizeInGB, List<String> eula) {
- return new Image(name, location, affinityGroup, label, description, category, os, mediaLink, logicalSizeInGB,
- eula);
- }
-
- // TODO: Remove from here down with @AutoValue.
- private Image(String name, String location, String affinityGroup, String label, String description, String category,
- OSType os, URI mediaLink, int logicalSizeInGB, List<String> eula) {
- this.name = checkNotNull(name, "name");
- this.location = location;
- this.affinityGroup = affinityGroup;
- this.label = checkNotNull(label, "label");
- this.description = description;
- this.category = category;
- this.os = checkNotNull(os, "os");
- this.mediaLink = mediaLink;
- this.logicalSizeInGB = logicalSizeInGB;
- this.eula = checkNotNull(eula, "eula");
- }
-
- private final String name;
- private final String location;
- private final String affinityGroup;
- private final String label;
- private final String category;
- private final String description;
- private final OSType os;
- private final URI mediaLink;
- private final int logicalSizeInGB;
- private final List<String> eula;
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof Image) {
- Image that = Image.class.cast(object);
- return equal(name, that.name)
- && equal(location, that.location)
- && equal(affinityGroup, that.affinityGroup)
- && equal(label, that.label)
- && equal(description, that.description)
- && equal(category, that.category)
- && equal(os, that.os)
- && equal(mediaLink, that.mediaLink)
- && equal(logicalSizeInGB, that.logicalSizeInGB)
- && equal(eula, that.eula);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, location, affinityGroup, label, description, category, os, mediaLink,
- logicalSizeInGB, eula);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("name", name)
- .add("location", location)
- .add("affinityGroup", affinityGroup)
- .add("label", label)
- .add("description", description)
- .add("category", category)
- .add("os", os)
- .add("mediaLink", mediaLink)
- .add("logicalSizeInGB", logicalSizeInGB)
- .add("eula", eula).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ImageParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ImageParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ImageParams.java
deleted file mode 100644
index ed72936..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/ImageParams.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.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import org.jclouds.azurecompute.domain.Image.OSType;
-
-import com.google.common.base.Objects;
-
-/** To create a new operating system image. */
-public final class ImageParams {
-
- /** Specifies a name that is used to identify the image when you create a Virtual Machine. */
- public String name() {
- return name;
- }
-
- /** Specifies the friendly name of the image. */
- public String label() {
- return label;
- }
-
- /** Specifies the location of the vhd file for the image. */
- public URI mediaLink() {
- return mediaLink;
- }
-
- /** {@link Image#os() Os type} of the image. */
- public OSType os() {
- return os;
- }
-
- public Builder toBuilder() {
- return builder().fromImageParams(this);
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static final class Builder {
- private String name;
- private String label;
- private URI mediaLink;
- private OSType os;
-
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- public Builder label(String label) {
- this.label = label;
- return this;
- }
-
- public Builder mediaLink(URI mediaLink) {
- this.mediaLink = mediaLink;
- return this;
- }
-
- public Builder os(OSType os) {
- this.os = os;
- return this;
- }
-
- public ImageParams build() {
- return ImageParams.create(name, label, mediaLink, os);
- }
-
- public Builder fromImageParams(ImageParams in) {
- return name(in.name())
- .label(in.label())
- .mediaLink(in.mediaLink())
- .os(in.os());
- }
- }
-
- private static ImageParams create(String name, String label, URI mediaLink, OSType os) {
- return new ImageParams(name, label, mediaLink, os);
- }
-
- // TODO: Remove from here down with @AutoValue.
- private ImageParams(String name, String label, URI mediaLink, OSType os) {
- this.name = checkNotNull(name, "name");
- this.label = checkNotNull(label, "label");
- this.mediaLink = checkNotNull(mediaLink, "mediaLink");
- this.os = checkNotNull(os, "os");
- }
-
- private final String name;
- private final String label;
- private final URI mediaLink;
- private final OSType os;
-
- @Override public int hashCode() {
- return Objects.hashCode(name, label, mediaLink, os);
- }
-
- @Override public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof ImageParams) {
- ImageParams that = ImageParams.class.cast(object);
- return equal(name, that.name)
- && equal(label, that.label)
- && equal(mediaLink, that.mediaLink)
- && equal(os, that.os);
- } else {
- return false;
- }
- }
-
- @Override public String toString() {
- return toStringHelper(this)
- .add("name", name)
- .add("label", label)
- .add("mediaLink", mediaLink)
- .add("os", os).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java
new file mode 100644
index 0000000..5d1947c
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImage.java
@@ -0,0 +1,176 @@
+/*
+ * 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.domain;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * OS image from the image repository
+ *
+ * @see <a href="http://msdn.microsoft.com/en-us/library/jj157191" >api</a>
+ */
+public final class OSImage {
+ public enum Type {
+ LINUX, WINDOWS;
+ }
+
+ public String name() {
+ return name;
+ }
+
+ /** The geo-locations of the image, if the image is not associated with an affinity group. */
+ public List<String> locations() {
+ return locations;
+ }
+
+ /** The affinity group with which this image is associated, if any. */
+ @Nullable public String affinityGroup() {
+ return affinityGroup;
+ }
+
+ /**
+ * The name can be up to 100 characters in length. The name can be used identify the storage account for your
+ * tracking purposes.
+ */
+ public String label() {
+ return label;
+ }
+
+ @Nullable public String description() {
+ return description;
+ }
+
+ /**
+ * The repository classification of image. All user images have the category "User", but
+ * categories for other images could be, for example "Canonical"
+ */
+ @Nullable public String category() {
+ return category;
+ }
+
+ /** The operating system type of the OS image. */
+ public Type os() {
+ return os;
+ }
+
+ /**
+ * The locations of the blob in the blob store in which the media for the image is located. The
+ * blob locations belongs to a storage account in the subscription specified by the
+ * <subscription-id> value in the operation call.
+ *
+ * Example:
+ *
+ * http://example.blob.core.windows.net/disks/myimage.vhd
+ */
+ @Nullable public URI mediaLink() {
+ return mediaLink;
+ }
+
+ public int logicalSizeInGB() {
+ return logicalSizeInGB;
+ }
+
+ /** The eulas for the image, if available. */
+ // Not URI as some providers put non-uri data in, such as riverbed.
+ public List<String> eula() {
+ return eula;
+ }
+
+ public static OSImage create(String name, List<String> locations, String affinityGroup, String label,
+ String description, String category, Type os, URI mediaLink, int logicalSizeInGB, List<String> eula) {
+ return new OSImage(name, locations, affinityGroup, label, description, category, os, mediaLink, logicalSizeInGB,
+ eula);
+ }
+
+ // TODO: Remove from here down with @AutoValue.
+ private OSImage(String name, List<String> locations, String affinityGroup, String label, String description,
+ String category, Type os, URI mediaLink, int logicalSizeInGB, List<String> eula) {
+ this.name = checkNotNull(name, "name");
+ this.locations = locations;
+ this.affinityGroup = affinityGroup;
+ this.label = checkNotNull(label, "label");
+ this.description = description;
+ this.category = category;
+ this.os = checkNotNull(os, "os");
+ this.mediaLink = mediaLink;
+ this.logicalSizeInGB = logicalSizeInGB;
+ this.eula = checkNotNull(eula, "eula");
+ }
+
+ private final String name;
+ private final List<String> locations;
+ private final String affinityGroup;
+ private final String label;
+ private final String category;
+ private final String description;
+ private final Type os;
+ private final URI mediaLink;
+ private final int logicalSizeInGB;
+ private final List<String> eula;
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof OSImage) {
+ OSImage that = OSImage.class.cast(object);
+ return equal(name, that.name)
+ && equal(locations, that.locations)
+ && equal(affinityGroup, that.affinityGroup)
+ && equal(label, that.label)
+ && equal(description, that.description)
+ && equal(category, that.category)
+ && equal(os, that.os)
+ && equal(mediaLink, that.mediaLink)
+ && equal(logicalSizeInGB, that.logicalSizeInGB)
+ && equal(eula, that.eula);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, locations, affinityGroup, label, description, category, os, mediaLink,
+ logicalSizeInGB, eula);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("name", name)
+ .add("locations", locations)
+ .add("affinityGroup", affinityGroup)
+ .add("label", label)
+ .add("description", description)
+ .add("category", category)
+ .add("os", os)
+ .add("mediaLink", mediaLink)
+ .add("logicalSizeInGB", logicalSizeInGB)
+ .add("eula", eula).toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImageParams.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImageParams.java b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImageParams.java
new file mode 100644
index 0000000..8f3c237
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/domain/OSImageParams.java
@@ -0,0 +1,139 @@
+/*
+ * 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.domain;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+
+import com.google.common.base.Objects;
+
+/** To create a new operating system image. */
+public final class OSImageParams {
+
+ /** Specifies a name that is used to identify the image when you create a Virtual Machine. */
+ public String name() {
+ return name;
+ }
+
+ /** Specifies the friendly name of the image. */
+ public String label() {
+ return label;
+ }
+
+ /** Specifies the location of the vhd file for the image. */
+ public URI mediaLink() {
+ return mediaLink;
+ }
+
+ /** {@link OSImage#os() Os type} of the image. */
+ public OSImage.Type os() {
+ return os;
+ }
+
+ public Builder toBuilder() {
+ return builder().fromImageParams(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder {
+ private String name;
+ private String label;
+ private URI mediaLink;
+ private OSImage.Type os;
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder label(String label) {
+ this.label = label;
+ return this;
+ }
+
+ public Builder mediaLink(URI mediaLink) {
+ this.mediaLink = mediaLink;
+ return this;
+ }
+
+ public Builder os(OSImage.Type os) {
+ this.os = os;
+ return this;
+ }
+
+ public OSImageParams build() {
+ return OSImageParams.create(name, label, mediaLink, os);
+ }
+
+ public Builder fromImageParams(OSImageParams in) {
+ return name(in.name())
+ .label(in.label())
+ .mediaLink(in.mediaLink())
+ .os(in.os());
+ }
+ }
+
+ private static OSImageParams create(String name, String label, URI mediaLink, OSImage.Type os) {
+ return new OSImageParams(name, label, mediaLink, os);
+ }
+
+ // TODO: Remove from here down with @AutoValue.
+ private OSImageParams(String name, String label, URI mediaLink, OSImage.Type os) {
+ this.name = checkNotNull(name, "name");
+ this.label = checkNotNull(label, "label");
+ this.mediaLink = checkNotNull(mediaLink, "mediaLink");
+ this.os = checkNotNull(os, "os");
+ }
+
+ private final String name;
+ private final String label;
+ private final URI mediaLink;
+ private final OSImage.Type os;
+
+ @Override public int hashCode() {
+ return Objects.hashCode(name, label, mediaLink, os);
+ }
+
+ @Override public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof OSImageParams) {
+ OSImageParams that = OSImageParams.class.cast(object);
+ return equal(name, that.name)
+ && equal(label, that.label)
+ && equal(mediaLink, that.mediaLink)
+ && equal(os, that.os);
+ } else {
+ return false;
+ }
+ }
+
+ @Override public String toString() {
+ return toStringHelper(this)
+ .add("name", name)
+ .add("label", label)
+ .add("mediaLink", mediaLink)
+ .add("os", os).toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/features/DiskApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/features/DiskApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/features/DiskApi.java
index 1d43707..4390524 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/features/DiskApi.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/features/DiskApi.java
@@ -16,7 +16,11 @@
*/
package org.jclouds.azurecompute.features;
+import static org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+
import java.util.List;
+
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -24,6 +28,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType;
+
import org.jclouds.azurecompute.domain.Disk;
import org.jclouds.azurecompute.functions.ParseRequestIdHeader;
import org.jclouds.azurecompute.xml.ListDisksHandler;
@@ -32,9 +37,6 @@ import org.jclouds.rest.annotations.Headers;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.XMLResponseParser;
-import static org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
-import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
-
/**
* The Service Management API includes operations for managing the disks in your subscription.
*
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/features/ImageApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/features/ImageApi.java
deleted file mode 100644
index 3ca54c3..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/features/ImageApi.java
+++ /dev/null
@@ -1,101 +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.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_XML;
-import static org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
-import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
-
-import java.util.List;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.jclouds.azurecompute.binders.ImageParamsToXML;
-import org.jclouds.azurecompute.domain.Image;
-import org.jclouds.azurecompute.domain.ImageParams;
-import org.jclouds.azurecompute.functions.ImageParamsName;
-import org.jclouds.azurecompute.functions.ParseRequestIdHeader;
-import org.jclouds.azurecompute.xml.ListImagesHandler;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.ParamParser;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.XMLResponseParser;
-
-/**
- * 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>
- */
-@Path("/services/images")
-@Headers(keys = "x-ms-version", values = "{jclouds.api-version}")
-@Consumes(APPLICATION_XML)
-public interface ImageApi {
-
- /**
- * The List Cloud Services operation lists the cloud services available under the current
- * subscription.
- */
- @Named("ListImages")
- @GET
- @XMLResponseParser(ListImagesHandler.class)
- @Fallback(EmptyListOnNotFoundOr404.class)
- List<Image> list();
-
- /**
- * The Add OS Image operation adds an OS image that is currently stored in a storage account in your subscription to
- * the image repository.
- */
- @Named("AddImage")
- @POST
- @Produces(APPLICATION_XML)
- @ResponseParser(ParseRequestIdHeader.class)
- String add(@BinderParam(ImageParamsToXML.class) ImageParams params);
-
- /**
- * The Update OS Image operation updates an OS image that in your image repository.
- */
- @Named("UpdateImage")
- @PUT
- @Path("/{imageName}")
- @Produces(APPLICATION_XML)
- @ResponseParser(ParseRequestIdHeader.class)
- String update(@PathParam("imageName") @ParamParser(ImageParamsName.class)
- @BinderParam(ImageParamsToXML.class) ImageParams params);
-
- /**
- * The Delete Cloud Service operation deletes the specified cloud service from Windows Azure.
- *
- * @param imageName
- * the unique DNS Prefix value in the Windows Azure Management Portal
- */
- @Named("DeleteImage")
- @DELETE
- @Path("/{imageName}")
- @Fallback(NullOnNotFoundOr404.class)
- @ResponseParser(ParseRequestIdHeader.class)
- String delete(@PathParam("imageName") String imageName);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/features/LocationApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/features/LocationApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/features/LocationApi.java
index 2a77e68..0ef5ee0 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/features/LocationApi.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/features/LocationApi.java
@@ -16,20 +16,22 @@
*/
package org.jclouds.azurecompute.features;
+import static org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+
import java.util.List;
+
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
+
import org.jclouds.azurecompute.domain.Location;
import org.jclouds.azurecompute.xml.ListLocationsHandler;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Headers;
import org.jclouds.rest.annotations.XMLResponseParser;
-import static org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
-
/**
* The Service Management API includes operations for listing the available data center locations
* for a cloud service in your subscription.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/features/OSImageApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/features/OSImageApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/features/OSImageApi.java
new file mode 100644
index 0000000..42c58a0
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/features/OSImageApi.java
@@ -0,0 +1,101 @@
+/*
+ * 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.features;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_XML;
+import static org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+
+import java.util.List;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import org.jclouds.azurecompute.binders.OSImageParamsToXML;
+import org.jclouds.azurecompute.domain.OSImage;
+import org.jclouds.azurecompute.domain.OSImageParams;
+import org.jclouds.azurecompute.functions.OSImageParamsName;
+import org.jclouds.azurecompute.functions.ParseRequestIdHeader;
+import org.jclouds.azurecompute.xml.ListOSImagesHandler;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.ParamParser;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.XMLResponseParser;
+
+/**
+ * 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>
+ */
+@Path("/services/images")
+@Headers(keys = "x-ms-version", values = "{jclouds.api-version}")
+@Consumes(APPLICATION_XML)
+public interface OSImageApi {
+
+ /**
+ * The List Cloud Services operation lists the cloud services available under the current
+ * subscription.
+ */
+ @Named("ListImages")
+ @GET
+ @XMLResponseParser(ListOSImagesHandler.class)
+ @Fallback(EmptyListOnNotFoundOr404.class)
+ List<OSImage> list();
+
+ /**
+ * The Add OS Image operation adds an OS image that is currently stored in a storage account in your subscription to
+ * the image repository.
+ */
+ @Named("AddImage")
+ @POST
+ @Produces(APPLICATION_XML)
+ @ResponseParser(ParseRequestIdHeader.class)
+ String add(@BinderParam(OSImageParamsToXML.class) OSImageParams params);
+
+ /**
+ * The Update OS Image operation updates an OS image that in your image repository.
+ */
+ @Named("UpdateImage")
+ @PUT
+ @Path("/{imageName}")
+ @Produces(APPLICATION_XML)
+ @ResponseParser(ParseRequestIdHeader.class)
+ String update(@PathParam("imageName") @ParamParser(OSImageParamsName.class)
+ @BinderParam(OSImageParamsToXML.class) OSImageParams params);
+
+ /**
+ * The Delete Cloud Service operation deletes the specified cloud service from Windows Azure.
+ *
+ * @param imageName
+ * the unique DNS Prefix value in the Windows Azure Management Portal
+ */
+ @Named("DeleteImage")
+ @DELETE
+ @Path("/{imageName}")
+ @Fallback(NullOnNotFoundOr404.class)
+ @ResponseParser(ParseRequestIdHeader.class)
+ String delete(@PathParam("imageName") String imageName);
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/features/OperationApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/features/OperationApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/features/OperationApi.java
index 5ee97a6..ac4092b 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/features/OperationApi.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/features/OperationApi.java
@@ -16,20 +16,21 @@
*/
package org.jclouds.azurecompute.features;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType;
+
import org.jclouds.azurecompute.domain.Operation;
import org.jclouds.azurecompute.xml.OperationHandler;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Headers;
import org.jclouds.rest.annotations.XMLResponseParser;
-import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
-
/**
* The Service Management API includes one operation for tracking the progress of asynchronous requests.
*
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/features/VirtualMachineApi.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/features/VirtualMachineApi.java b/azurecompute/src/main/java/org/jclouds/azurecompute/features/VirtualMachineApi.java
index 5067029..9f54ed0 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/features/VirtualMachineApi.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/features/VirtualMachineApi.java
@@ -23,6 +23,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+
import org.jclouds.azurecompute.functions.ParseRequestIdHeader;
import org.jclouds.rest.annotations.Headers;
import org.jclouds.rest.annotations.Payload;
@@ -48,7 +49,7 @@ public interface VirtualMachineApi {
@Path("/{name}/Operations")
@Produces(MediaType.APPLICATION_XML)
@ResponseParser(ParseRequestIdHeader.class)
- @Payload(value = "<RestartRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><OperationType>RestartRoleOperation</OperationType></RestartRoleOperation>")
+ @Payload(value = "<RestartRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\"><OperationType>RestartRoleOperation</OperationType></RestartRoleOperation>")
String restart(@PathParam("name") String name);
/**
@@ -59,7 +60,7 @@ public interface VirtualMachineApi {
@Path("/{name}/Operations")
@Produces(MediaType.APPLICATION_XML)
@ResponseParser(ParseRequestIdHeader.class)
- @Payload(value = "<CaptureRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><OperationType>CaptureRoleOperation</OperationType><PostCaptureAction>Delete</PostCaptureAction><TargetImageLabel>{imageLabel}</TargetImageLabel><TargetImageName>{imageName}</TargetImageName></CaptureRoleOperation>")
+ @Payload(value = "<CaptureRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\"><OperationType>CaptureRoleOperation</OperationType><PostCaptureAction>Delete</PostCaptureAction><TargetImageLabel>{imageLabel}</TargetImageLabel><TargetImageName>{imageName}</TargetImageName></CaptureRoleOperation>")
String capture(@PathParam("name") String name, @PayloadParam("imageName") String imageName,
@PayloadParam("imageLabel") String imageLabel);
@@ -71,7 +72,7 @@ public interface VirtualMachineApi {
@Path("/{name}/Operations")
@Produces(MediaType.APPLICATION_XML)
@ResponseParser(ParseRequestIdHeader.class)
- @Payload(value = "<ShutdownRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><OperationType>ShutdownRoleOperation</OperationType></ShutdownRoleOperation>")
+ @Payload(value = "<ShutdownRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\"><OperationType>ShutdownRoleOperation</OperationType></ShutdownRoleOperation>")
String shutdown(@PathParam("name") String name);
/**
@@ -82,6 +83,6 @@ public interface VirtualMachineApi {
@Path("/{name}/Operations")
@Produces(MediaType.APPLICATION_XML)
@ResponseParser(ParseRequestIdHeader.class)
- @Payload(value = "<StartRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><OperationType>StartRoleOperation</OperationType></StartRoleOperation>")
+ @Payload(value = "<StartRoleOperation xmlns=\"http://schemas.microsoft.com/windowsazure\"><OperationType>StartRoleOperation</OperationType></StartRoleOperation>")
String start(@PathParam("name") String name);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ImageParamsName.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ImageParamsName.java b/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ImageParamsName.java
deleted file mode 100644
index 3b2c458..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ImageParamsName.java
+++ /dev/null
@@ -1,27 +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.functions;
-
-import org.jclouds.azurecompute.domain.ImageParams;
-
-import com.google.common.base.Function;
-
-public class ImageParamsName implements Function<Object, String> {
- @Override public String apply(Object input) {
- return ImageParams.class.cast(input).name();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/functions/OSImageParamsName.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/functions/OSImageParamsName.java b/azurecompute/src/main/java/org/jclouds/azurecompute/functions/OSImageParamsName.java
new file mode 100644
index 0000000..7b962e7
--- /dev/null
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/functions/OSImageParamsName.java
@@ -0,0 +1,27 @@
+/*
+ * 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.functions;
+
+import org.jclouds.azurecompute.domain.OSImageParams;
+
+import com.google.common.base.Function;
+
+public class OSImageParamsName implements Function<Object, String> {
+ @Override public String apply(Object input) {
+ return OSImageParams.class.cast(input).name();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ParseRequestIdHeader.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ParseRequestIdHeader.java b/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ParseRequestIdHeader.java
index 2a0d5aa..db229be 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ParseRequestIdHeader.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/functions/ParseRequestIdHeader.java
@@ -16,11 +16,13 @@
*/
package org.jclouds.azurecompute.functions;
-import com.google.common.base.Function;
+import static org.jclouds.http.HttpUtils.releasePayload;
+
import javax.inject.Singleton;
+
import org.jclouds.http.HttpResponse;
-import static org.jclouds.http.HttpUtils.releasePayload;
+import com.google.common.base.Function;
/**
* Parses an x-ms-request-id the header
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/KeyStoreSupplier.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/KeyStoreSupplier.java b/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/KeyStoreSupplier.java
index d4955e1..d90bd16 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/KeyStoreSupplier.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/KeyStoreSupplier.java
@@ -16,9 +16,9 @@
*/
package org.jclouds.azurecompute.suppliers;
-import com.google.common.base.Charsets;
-import com.google.common.base.Supplier;
-import com.google.common.io.ByteSource;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Throwables.propagate;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -34,15 +34,18 @@ import java.security.cert.CertificateFactory;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.Collection;
+
import javax.inject.Inject;
import javax.inject.Singleton;
+
import org.jclouds.crypto.Crypto;
import org.jclouds.crypto.Pems;
import org.jclouds.domain.Credentials;
import org.jclouds.location.Provider;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Throwables.propagate;
+import com.google.common.base.Charsets;
+import com.google.common.base.Supplier;
+import com.google.common.io.ByteSource;
/**
* TODO this code needs to be completely refactored. It needs to stop using KeyStore of at all possible and definitely
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/SSLContextWithKeysSupplier.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/SSLContextWithKeysSupplier.java b/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/SSLContextWithKeysSupplier.java
index 1936bf8..da9a2a3 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/SSLContextWithKeysSupplier.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/suppliers/SSLContextWithKeysSupplier.java
@@ -16,25 +16,28 @@
*/
package org.jclouds.azurecompute.suppliers;
-import com.google.common.base.Supplier;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Throwables.propagate;
+
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
+
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
+
import org.jclouds.domain.Credentials;
import org.jclouds.http.HttpUtils;
import org.jclouds.http.config.SSLModule.TrustAllCerts;
import org.jclouds.location.Provider;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Throwables.propagate;
+import com.google.common.base.Supplier;
/**
* TODO this code needs to be completely refactored. It needs to stop using KeyStore of at all possible and definitely
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
index 3792527..b3ae8c2 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/DiskHandler.java
@@ -22,7 +22,7 @@ import java.net.URI;
import org.jclouds.azurecompute.domain.Disk;
import org.jclouds.azurecompute.domain.Disk.Attachment;
-import org.jclouds.azurecompute.domain.Image.OSType;
+import org.jclouds.azurecompute.domain.OSImage;
import org.jclouds.http.functions.ParseSax;
import org.xml.sax.Attributes;
@@ -34,7 +34,7 @@ final class DiskHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Di
private String location;
private String affinityGroup;
private String description;
- private OSType os;
+ private OSImage.Type os;
private URI mediaLink;
private Integer logicalSizeInGB;
private Attachment attachedTo;
@@ -74,7 +74,7 @@ final class DiskHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Di
} else if (qName.equals("OS")) {
String osText = currentOrNull(currentText);
if (osText != null) {
- os = OSType.valueOf(currentOrNull(currentText).toUpperCase());
+ os = OSImage.Type.valueOf(currentOrNull(currentText).toUpperCase());
}
} else if (qName.equals("Name")) {
name = currentOrNull(currentText);
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ImageHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ImageHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ImageHandler.java
deleted file mode 100644
index f13dd5d..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ImageHandler.java
+++ /dev/null
@@ -1,109 +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.xml;
-
-import static com.google.common.base.Strings.emptyToNull;
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import java.net.URI;
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.Image;
-import org.jclouds.azurecompute.domain.Image.OSType;
-import org.jclouds.http.functions.ParseSax;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-/**
- * @see <a href="http://msdn.microsoft.com/en-us/library/jj157191" >api</a>
- */
-final class ImageHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Image> {
- private String name;
- private String location;
- private String affinityGroup;
- private String label;
- private String category;
- private String description;
- private OSType os;
- private URI mediaLink;
- private Integer logicalSizeInGB;
- private final List<String> eula = Lists.newArrayList();
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override public Image getResult() {
- Image result = Image.create(name, location, affinityGroup, label, description, category, os, mediaLink,
- logicalSizeInGB, ImmutableList.copyOf(eula));
- resetState(); // handler is called in a loop.
- return result;
- }
-
- private void resetState() {
- name = location = affinityGroup = label = description = category = null;
- os = null;
- mediaLink = null;
- logicalSizeInGB = null;
- eula.clear();
- }
-
- @Override public void endElement(String ignoredUri, String ignoredName, String qName) {
- if (qName.equals("OS")) {
- String osText = currentOrNull(currentText);
- if (osText != null) {
- os = OSType.valueOf(currentOrNull(currentText).toUpperCase());
- }
- } else if (qName.equals("Name")) {
- name = currentOrNull(currentText);
- } else if (qName.equals("LogicalSizeInGB")) {
- String gb = currentOrNull(currentText);
- if (gb != null) {
- logicalSizeInGB = Integer.parseInt(gb);
- }
- } else if (qName.equals("Description")) {
- description = currentOrNull(currentText);
- } else if (qName.equals("Category")) {
- category = currentOrNull(currentText);
- } else if (qName.equals("Location")) {
- location = currentOrNull(currentText);
- } else if (qName.equals("AffinityGroup")) {
- affinityGroup = currentOrNull(currentText);
- } else if (qName.equals("MediaLink")) {
- String link = currentOrNull(currentText);
- if (link != null) {
- mediaLink = URI.create(link);
- }
- } else if (qName.equals("Eula")) {
- String eulaField = currentOrNull(currentText);
- if (eulaField != null) {
- for (String eula : Splitter.on(';').split(eulaField)) {
- if ((eula = emptyToNull(eula.trim())) != null) { // Dirty data in RightScale eula field.
- this.eula.add(eula);
- }
- }
- }
- } else if (qName.equals("Label")) {
- label = currentOrNull(currentText);
- }
- currentText.setLength(0);
- }
-
- @Override public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7f307e85/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListImagesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListImagesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListImagesHandler.java
deleted file mode 100644
index f220f8c..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListImagesHandler.java
+++ /dev/null
@@ -1,61 +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.xml;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.Image;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-
-public final class ListImagesHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<Image>> {
- private boolean inOSImage;
- private final ImageHandler imageHandler = new ImageHandler();
- private final Builder<Image> images = ImmutableList.builder();
-
- @Override
- public List<Image> getResult() {
- return images.build();
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("OSImage")) {
- inOSImage = true;
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("OSImage")) {
- inOSImage = false;
- images.add(imageHandler.getResult());
- } else if (inOSImage) {
- imageHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(char ch[], int start, int length) {
- if (inOSImage) {
- imageHandler.characters(ch, start, length);
- }
- }
-}