http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSHKey.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSHKey.java b/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSHKey.java deleted file mode 100644 index bf85b86..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/SSHKey.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.domain.role.conf; - -import javax.xml.bind.annotation.XmlElement; - -public class SSHKey { - - /** - * Specifies the SHA1 fingerprint of an X509 certificate associated with the hosted service that - * includes the SSH public key. - */ - @XmlElement(required = true, name = "FingerPrint") - protected String fingerPrint; - - /** - * Specifies the full path of a file, on the virtual machine, which stores the SSH public key. If - * the file already exists, the specified key is appended to the file. - */ - @XmlElement(required = true, name = "Path") - protected String path; - - public SSHKey() { - } - - public String getFingerPrint() { - return fingerPrint; - } - - public void setFingerPrint(String fingerPrint) { - this.fingerPrint = fingerPrint; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java b/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java deleted file mode 100644 index c7a0cb1..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/WindowsProvisioningConfiguration.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.domain.role.conf; - -import java.util.List; -import java.util.TimeZone; - -import com.google.common.collect.Lists; - -//@XmlRootElement(name = "ConfigurationSet") -public class WindowsProvisioningConfiguration extends ConfigurationSet { - - public static final String ID = "WindowsProvisioningConfiguration"; - - /** - * Specifies the computer name for the virtual machine - * - * Computer names must be 1 to 15 characters in length. - */ - // @XmlElement(name = "ComputerName") - private String computerName; - /** - * Specifies the base-64 encoded string representing the administrator password to use for the - * virtual machine. - */ - // @XmlElement(required = true, name = "AdminPassword") - private String adminPassword; - /** - * Specifies whether the user must change the administrator password on first logon. The default - * value is false. - */ - // @XmlElement(required = true, name = "ResetPasswordOnFirstLogon") - private Boolean resetPasswordOnFirstLogon; - /** - * Specifies whether automatic updates are enabled for the virtual machine. The default value is - * true. - */ - // @XmlElement(name = "EnableAutomaticUpdates") - private Boolean enableAutomaticUpdates; - /** - * Specifies the time zone for the virtual machine. - */ - // @XmlElement(name = "TimeZone") - private TimeZone timeZone; - /** - * Contains properties that specify a domain to which the virtual machine will be joined. The - * DomainJoin node contains either credentials or provisioning information. - */ - // @XmlElement(name = "DomainJoin") - private DomainJoin domainJoin; - /** - * Contains a list of service certificates with which to provision to the new virtual machine. - */ - // @XmlElementWrapper(required = true, name = "StoredCertificateSettings") - // @XmlElement(name = "CertificateSetting") - private List<CertificateSetting> storedCertificateSettings = Lists.newArrayList(); - - public WindowsProvisioningConfiguration() { - - } - - public String getComputerName() { - return computerName; - } - - public void setComputerName(String computerName) { - this.computerName = computerName; - } - - public String getAdminPassword() { - return adminPassword; - } - - public void setAdminPassword(String adminPassword) { - this.adminPassword = adminPassword; - } - - public Boolean getResetPasswordOnFirstLogon() { - return resetPasswordOnFirstLogon; - } - - public void setResetPasswordOnFirstLogon(Boolean resetPasswordOnFirstLogon) { - this.resetPasswordOnFirstLogon = resetPasswordOnFirstLogon; - } - - public Boolean getEnableAutomaticUpdates() { - return enableAutomaticUpdates; - } - - public void setEnableAutomaticUpdates(Boolean enableAutomaticUpdates) { - this.enableAutomaticUpdates = enableAutomaticUpdates; - } - - public TimeZone getTimeZone() { - return timeZone; - } - - public void setTimeZone(TimeZone timeZone) { - this.timeZone = timeZone; - } - - public DomainJoin getDomainJoin() { - return domainJoin; - } - - public void setDomainJoin(DomainJoin domainJoin) { - this.domainJoin = domainJoin; - } - - public List<CertificateSetting> getStoredCertificateSettings() { - return storedCertificateSettings; - } - - public void setStoredCertificateSettings(List<CertificateSetting> storedCertificateSettings) { - this.storedCertificateSettings = storedCertificateSettings; - } - - @Override - public String toString() { - return "WindowsProvisioningConfigurationSet [computerName=" + computerName + ", adminPassword=" + adminPassword - + ", resetPasswordOnFirstLogon=" + resetPasswordOnFirstLogon + ", enableAutomaticUpdates=" - + enableAutomaticUpdates + ", timeZone=" + timeZone + ", domainJoin=" + domainJoin - + ", storedCertificateSettings=" + storedCertificateSettings + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/package-info.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/package-info.java b/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/package-info.java deleted file mode 100644 index 4f7b323..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/conf/package-info.java +++ /dev/null @@ -1,25 +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. - */ -@XmlSchema(namespace = "http://schemas.microsoft.com/windowsazure", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -@XmlAccessorType(XmlAccessType.FIELD) -//@XmlJavaTypeAdapters({@XmlJavaTypeAdapter(NetworkConfigurationSetAdapter.class),@XmlJavaTypeAdapter(LinuxProvisioningConfigurationSetAdapter.class)}) -package org.jclouds.azure.management.domain.role.conf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlSchema; - http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/domain/role/package-info.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/package-info.java b/azure-management/src/main/java/org/jclouds/azure/management/domain/role/package-info.java deleted file mode 100644 index 3d9ed50..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/domain/role/package-info.java +++ /dev/null @@ -1,25 +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. - */ -@XmlSchema(namespace = "http://schemas.microsoft.com/windowsazure", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -@XmlAccessorType(XmlAccessType.FIELD) -//@XmlJavaTypeAdapters({@XmlJavaTypeAdapter(NetworkConfigurationSetAdapter.class),@XmlJavaTypeAdapter(LinuxProvisioningConfigurationSetAdapter.class)}) -package org.jclouds.azure.management.domain.role; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlSchema; - http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/DiskApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/DiskApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/DiskApi.java deleted file mode 100644 index 68f91c5..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/DiskApi.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import java.util.Set; -import org.jclouds.azure.management.domain.Disk; - -/** - * The Service Management API includes operations for managing the disks in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157188">docs</a> - * @see DiskAsyncApi - */ -public interface DiskApi { - - /** - * The List Disks operation retrieves a list of the disks in your image repository. - */ - Set<Disk> list(); - - /** - * The Delete Disk operation deletes the specified data or operating system disk from your image - * repository. - * - * @return request id or null, if not found - * - */ - String delete(String diskName); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/DiskAsyncApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/DiskAsyncApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/DiskAsyncApi.java deleted file mode 100644 index 2c32b5e..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/DiskAsyncApi.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import java.util.Set; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.azure.management.domain.Disk; -import org.jclouds.azure.management.functions.ParseRequestIdHeader; -import org.jclouds.azure.management.xml.ListDisksHandler; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The Service Management API includes operations for managing the virtual machines Disk in your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157188">docs</a> - * @see DiskApi - */ -@Headers(keys = "x-ms-version", values = "2012-03-01") -public interface DiskAsyncApi { - - /** - * @see DiskApi#list() - */ - @Named("ListDisks") - @GET - @Path("/services/disks") - @XMLResponseParser(ListDisksHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<Set<Disk>> list(); - - /** - * @see DiskApi#delete - */ - @Named("DeleteDisk") - @DELETE - @Path("/services/disks/{diskName}") - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - ListenableFuture<String> delete(@PathParam("diskName") String imageName); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceApi.java deleted file mode 100644 index 25dad7e..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceApi.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import java.util.Set; -import org.jclouds.azure.management.domain.Deployment; -import org.jclouds.azure.management.domain.HostedService; -import org.jclouds.azure.management.domain.HostedServiceWithDetailedProperties; -import org.jclouds.azure.management.options.CreateHostedServiceOptions; - -/** - * The Service Management API includes operations for managing the hosted services beneath your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460812">docs</a> - * @see HostedServiceAsyncApi - */ -public interface HostedServiceApi { - - /** - * The List Hosted Services operation lists the hosted services available under the current - * subscription. - * - * @return the response object - */ - Set<HostedServiceWithDetailedProperties> list(); - - /** - * The Create Hosted Service operation creates a new hosted service in Windows Azure. - * - * @param serviceName - * A name for the hosted service that is unique within Windows Azure. This name is the - * DNS prefix name and can be used to access the hosted service. - * - * For example: http://ServiceName.cloudapp.net// - * @param label - * The name can be used identify the storage account for your tracking purposes. The - * name can be up to 100 characters in length. - * @param location - * The location where the hosted service will be created. - * @return the requestId to track this async request progress - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460812">docs</a> - */ - String createServiceWithLabelInLocation(String serviceName, String label, String location); - - /** - * same as {@link #createServiceWithLabelInLocation(String, String, String)} , except you can - * specify optional parameters such as extended properties or a description. - * - * @param options - * parameters such as extended properties or a description. - */ - String createServiceWithLabelInLocation(String serviceName, String label, String location, - CreateHostedServiceOptions options); - - /** - * The Get Hosted Service Properties operation retrieves system properties for the specified - * hosted service. These properties include the service name and service type; the name of the - * affinity group to which the service belongs, or its location if it is not part of an affinity - * group. - * - * @param serviceName - * the unique DNS Prefix value in the Windows Azure Management Portal - */ - HostedService get(String serviceName); - - /** - * like {@link #get(String)}, except additional data such as status and deployment information is - * returned. - * - * @param serviceName - * the unique DNS Prefix value in the Windows Azure Management Portal - */ - HostedServiceWithDetailedProperties getDetails(String serviceName); - - /** - * The Delete Hosted Service operation deletes the specified hosted service from Windows Azure. - * - * @param serviceName - * the unique DNS Prefix value in the Windows Azure Management Portal - * - * @return request id or null, if not found - */ - String delete(String serviceName); - - /** - * http://msdn.microsoft.com/en-us/library/ee460813 - * - * @param serviceName - * the unique DNS Prefix value in the Windows Azure Management Portal - * @param deploymentSlotName - * "staging" or "production", depending on where you wish to deploy your service - * package - * @param createDeployment - * the deployment to create - */ - // This is a PaaS REST service ! -// void createDeployment(String serviceName, String deploymentSlotName, CreateDeployment createDeployment); - - /** - * The Delete Deployment operation deletes the specified deployment from Windows Azure. - * - * @param serviceName - * the unique DNS Prefix value in the Windows Azure Management Portal - * @param deploymentName - * the unique DNS Prefix value in the Windows Azure Management Portal - */ - String deleteDeployment(String serviceName, String deploymentName); - - - /** - * The Get Deployment operation returns the specified deployment from Windows Azure. - * - * @param serviceName - * the unique DNS Prefix value in the Windows Azure Management Portal - * @param deploymentName - * the unique DNS Prefix value in the Windows Azure Management Portal - */ - Deployment getDeployment(String serviceName, String deploymentName); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceAsyncApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceAsyncApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceAsyncApi.java deleted file mode 100644 index 699b6dc..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/HostedServiceAsyncApi.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import java.util.Set; - -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.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.azure.management.binders.BindCreateHostedServiceToXmlPayload; -import org.jclouds.azure.management.domain.Deployment; -import org.jclouds.azure.management.domain.HostedService; -import org.jclouds.azure.management.domain.HostedServiceWithDetailedProperties; -import org.jclouds.azure.management.functions.ParseRequestIdHeader; -import org.jclouds.azure.management.options.CreateHostedServiceOptions; -import org.jclouds.azure.management.xml.DeploymentHandler; -import org.jclouds.azure.management.xml.HostedServiceHandler; -import org.jclouds.azure.management.xml.HostedServiceWithDetailedPropertiesHandler; -import org.jclouds.azure.management.xml.ListHostedServicesHandler; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.QueryParams; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The Service Management API includes operations for managing the hosted services beneath your - * subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460812">docs</a> - * @see HostedServiceApi - */ -@Headers(keys = "x-ms-version", values = "2012-03-01") -public interface HostedServiceAsyncApi { - - /** - * @see HostedServiceApi#list() - */ - @Named("ListHostedServices") - @GET - @Path("/services/hostedservices") - @XMLResponseParser(ListHostedServicesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<Set<HostedServiceWithDetailedProperties>> list(); - - /** - * @see HostedServiceApi#createServiceWithLabelInLocation(String, String, String) - */ - @Named("CreateHostedService") - @POST - @Path("/services/hostedservices") - @MapBinder(BindCreateHostedServiceToXmlPayload.class) - @Produces(MediaType.APPLICATION_XML) - @ResponseParser(ParseRequestIdHeader.class) - ListenableFuture<String> createServiceWithLabelInLocation(@PayloadParam("serviceName") String serviceName, - @PayloadParam("label") String label, @PayloadParam("location") String location); - - /** - * @see HostedServiceApi#createServiceWithLabelInLocation(String, String, String, - * CreateHostedServiceOptions) - */ - @Named("CreateHostedService") - @POST - @Path("/services/hostedservices") - @MapBinder(BindCreateHostedServiceToXmlPayload.class) - @Produces(MediaType.APPLICATION_XML) - @ResponseParser(ParseRequestIdHeader.class) - ListenableFuture<String> createServiceWithLabelInLocation(@PayloadParam("serviceName") String serviceName, - @PayloadParam("label") String label, @PayloadParam("location") String location, - @PayloadParam("options") CreateHostedServiceOptions options); - - /** - * @see HostedServiceApi#get(String) - */ - @Named("GetHostedServiceProperties") - @GET - @Path("/services/hostedservices/{serviceName}") - @XMLResponseParser(HostedServiceHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<HostedService> get(@PathParam("serviceName") String serviceName); - - /** - * @see HostedServiceApi#getDetails(String) - */ - @Named("GetHostedServiceProperties") - @GET - @Path("/services/hostedservices/{serviceName}") - @QueryParams(keys = "embed-detail", values = "true") - @XMLResponseParser(HostedServiceWithDetailedPropertiesHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<HostedServiceWithDetailedProperties> getDetails(@PathParam("serviceName") String serviceName); - - /** - * @see HostedServiceApi#delete(String) - */ - @Named("DeleteHostedService") - @DELETE - @Path("/services/hostedservices/{serviceName}") - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - ListenableFuture<String> delete(@PathParam("serviceName") String serviceName); - - /** - * @see HostedServiceApi#deleteDeployment(String, String) - */ - @Named("DeleteDeployment") - @DELETE - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}") - @Fallback(VoidOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - ListenableFuture<String> deleteDeployment(@PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName); - - /** - * @see HostedServiceApi#get(String,String) - */ - @Named("GetDeployment") - @GET - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}") - @XMLResponseParser(DeploymentHandler.class) - @Fallback(VoidOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<Deployment> getDeployment(@PathParam("serviceName") String serviceName, @PathParam("deploymentName") String deploymentName); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/LocationApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/LocationApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/LocationApi.java deleted file mode 100644 index 8c73f03..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/LocationApi.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import java.util.Set; -import org.jclouds.azure.management.domain.Location; - -/** - * The Service Management API includes operations for listing the available data center locations - * for a hosted service in your subscription. - * <p/> - * - * @see <a href="http://msdn.microsoft.com/en-us/library/gg441299" /> - * @see LocationAsyncApi - */ -public interface LocationApi { - - /** - * The List Locations operation lists all of the data center locations that are valid for your - * subscription. - * - * @return the response object - */ - Set<Location> list(); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/LocationAsyncApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/LocationAsyncApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/LocationAsyncApi.java deleted file mode 100644 index fcc1749..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/LocationAsyncApi.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import java.util.Set; - -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.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.azure.management.domain.Location; -import org.jclouds.azure.management.xml.ListLocationsHandler; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The Service Management API includes operations for listing the available data center locations - * for a hosted service in your subscription. - * <p/> - * - * @see <a href="http://msdn.microsoft.com/en-us/library/gg441299" /> - * @see LocationApi - */ -@Headers(keys = "x-ms-version", values = "2012-03-01") -public interface LocationAsyncApi { - - /** - * @see LocationApi#list() - */ - @Named("ListLocations") - @GET - @Path("/locations") - @XMLResponseParser(ListLocationsHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<Set<Location>> list(); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageApi.java deleted file mode 100644 index dc02e4f..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageApi.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import java.util.Set; -import org.jclouds.azure.management.domain.OSImage; -import org.jclouds.azure.management.domain.OSImageParams; - -/** - * The Service Management API includes operations for managing the OS images in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157175">docs</a> - * @see OSImageAsyncApi - */ -public interface OSImageApi { - - /** - * The List Hosted Services operation lists the hosted services available under the current - * subscription. - * - * @return the response object - */ - Set<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. - * - * @param params - * the required parameters needed to add an image - */ - void add(OSImageParams params); - - /** - * The Update OS Image operation updates an OS image that in your image repository. - * - * @param params - * the required parameters needed to update an image - */ - void update(OSImageParams params); - - /** - * The Delete Hosted Service operation deletes the specified hosted service from Windows Azure. - * - * @param imageName - * the unique DNS Prefix value in the Windows Azure Management Portal - */ - void delete(String imageName); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageAsyncApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageAsyncApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageAsyncApi.java deleted file mode 100644 index 23df1d2..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/OSImageAsyncApi.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.azure.management.features; - -import java.util.Set; - -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 javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.azure.management.binders.BindOSImageParamsToXmlPayload; -import org.jclouds.azure.management.domain.OSImage; -import org.jclouds.azure.management.domain.OSImageParams; -import org.jclouds.azure.management.functions.OSImageParamsName; -import org.jclouds.azure.management.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.XMLResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The Service Management API includes operations for managing the OS images in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj5775">docs</a> - * @see OSImageApi - */ -@Headers(keys = "x-ms-version", values = "2012-03-01") -public interface OSImageAsyncApi { - - /** - * @see OSImageApi#list() - */ - @Named("ListOsImages") - @GET - @Path("/services/images") - @XMLResponseParser(ListOSImagesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<Set<OSImage>> list(); - - /** - * @see OSImageApi#add(String) - */ - @Named("AddOsImage") - @POST - @Path("/services/images") - @Produces(MediaType.APPLICATION_XML) - ListenableFuture<Void> add(@BinderParam(BindOSImageParamsToXmlPayload.class) OSImageParams params); - - /** - * @see OSImageApi#update(String) - */ - @Named("UpdateOsImage") - @PUT - @Path("/services/images/{imageName}") - @Produces(MediaType.APPLICATION_XML) - ListenableFuture<Void> update( - @PathParam("imageName") @ParamParser(OSImageParamsName.class) @BinderParam(BindOSImageParamsToXmlPayload.class) OSImageParams params); - - /** - * @see OSImageApi#delete(String) - */ - @Named("DeleteOsImage") - @DELETE - @Path("/services/images/{imageName}") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture<Void> delete(@PathParam("imageName") String imageName); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/OperationApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/OperationApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/OperationApi.java deleted file mode 100644 index c2655d7..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/OperationApi.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import org.jclouds.azure.management.domain.Operation; - -/** - * The Service Management API includes one operation for tracking the progress of asynchronous requests. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460796">docs</a> - * @see OperationAsyncApi - */ -public interface OperationApi { - - Operation get(String requestId); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/OperationAsyncApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/OperationAsyncApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/OperationAsyncApi.java deleted file mode 100644 index 06011b2..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/OperationAsyncApi.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -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.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.azure.management.domain.Operation; -import org.jclouds.azure.management.xml.OperationHandler; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The Service Management API includes one operation for tracking the progress - * of asynchronous requests. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460796">docs</a> - * @see OperationApi - */ -@Headers(keys = "x-ms-version", values = "2012-03-01") -public interface OperationAsyncApi { - - /** - * @see OperationApi#get(String) - */ - @Named("GetOperation") - @GET - @Path("/operations/{request-id}") - @XMLResponseParser(OperationHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_XML) - ListenableFuture<Operation> get(@PathParam("request-id") String requestId); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java deleted file mode 100644 index cca3408..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import org.jclouds.azure.management.domain.DeploymentParams; -import org.jclouds.azure.management.domain.role.PersistentVMRole; - -/** - * The Service Management API includes operations for managing the virtual - * machines in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157206">docs</a> - * @see RoleAsyncApi - */ -public interface RoleApi { - - // TODO: this is not the good REST call !!! Use getDeployment instead :@ - PersistentVMRole getRole(String serviceName, String deploymentName, String roleName); - - String restartRole(String serviceName, String deploymentName, String roleName); - - /** - * http://msdn.microsoft.com/en-us/library/jj157194 - * - * @param serviceName - * @param deploymentParams - * @return - */ - String createDeployment(String serviceName, DeploymentParams deploymentParams); - - /** - * http://msdn.microsoft.com/en-us/library/jj157201 - * - * @return - */ - String captureRole(String serviceName, String deploymentName, String roleName, String imageName, String imageLabel); - - /** - * http://msdn.microsoft.com/en-us/library/jj157195 - * - * @param serviceName - * @param deploymentName - * @param roleName - * @return - */ - String shutdownRole(String serviceName, String deploymentName, String roleName); - - /** - * http://msdn.microsoft.com/en-us/library/jj157189 - * - * @param serviceName - * @param deploymentName - * @param roleName - * @return - */ - String startRole(String serviceName, String deploymentName, String roleName); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java b/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java deleted file mode 100644 index 2b1ee22..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.features; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.azure.management.binders.BindDeploymentParamsToXmlPayload; -import org.jclouds.azure.management.domain.DeploymentParams; -import org.jclouds.azure.management.domain.role.PersistentVMRole; -import org.jclouds.azure.management.functions.ParseRequestIdHeader; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.JAXBResponseParser; -import org.jclouds.rest.annotations.Payload; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.ResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * The Service Management API includes operations for managing the virtual - * machines in your subscription. - * - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157206">docs</a> - * @see RoleApi - */ -@Headers(keys = "x-ms-version", values = "2012-03-01") -public interface RoleAsyncApi { - - /** - * @see RoleApi#getRole(String, String, String) - */ - @Named("GetRole") - @GET - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles/{roleName}") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<PersistentVMRole> getRole(@PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, @PathParam("roleName") String roleName); - - /** - * @see RoleApi#restartRole(String, String, String) - */ - @Named("RestartRole") - @POST - // Warning : the url in the documentation is WRONG ! @see - // http://social.msdn.microsoft.com/Forums/pl-PL/WAVirtualMachinesforWindows/thread/7ba2367b-e450-49e0-89e4-46c240e9d213 - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @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>") - ListenableFuture<String> restartRole(@PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, @PathParam("roleName") String roleName); - - /** - * @see RoleApi#createDeployment(String, DeploymentParams) - */ - @Named("CreateVirtualMachineDeployment") - @POST - @Path("/services/hostedservices/{serviceName}/deployments") - @Produces(MediaType.APPLICATION_ATOM_XML) - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - ListenableFuture<String> createDeployment(@PathParam("serviceName") String serviceName, - @BinderParam(BindDeploymentParamsToXmlPayload.class) DeploymentParams deploymentParams); - - /** - * @see RoleApi#captureRole(String, String, String, String, String) - */ - @Named("CaptureRole") - @POST - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @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>") - ListenableFuture<String> captureRole(@PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, @PathParam("roleName") String roleName, - @PayloadParam("imageName") String imageName, @PayloadParam("imageLabel") String imageLabel); - - /** - * @see RoleApi#shutdownRole(String, String, String) - */ - @Named("ShutdownRole") - @POST - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @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>") - ListenableFuture<String> shutdownRole(@PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, @PathParam("roleName") String roleName); - - /** - * @see RoleApi#startRole(String, String, String) - */ - @Named("StartRole") - @POST - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @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>") - ListenableFuture<String> startRole(@PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, @PathParam("roleName") String roleName); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/functions/OSImageParamsName.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/functions/OSImageParamsName.java b/azure-management/src/main/java/org/jclouds/azure/management/functions/OSImageParamsName.java deleted file mode 100644 index 7be216a..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/functions/OSImageParamsName.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.functions; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Singleton; - -import org.jclouds.azure.management.domain.OSImageParams; - -import com.google.common.base.Function; - -@Singleton -public class OSImageParamsName implements Function<Object, String> { - @Override - public String apply(Object input) { - checkArgument(checkNotNull(input, "input") instanceof OSImageParams, - "this function is only valid for OSImageParams!"); - return checkNotNull(OSImageParams.class.cast(input), "OSImageParams").getName(); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/functions/ParseRequestIdHeader.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/functions/ParseRequestIdHeader.java b/azure-management/src/main/java/org/jclouds/azure/management/functions/ParseRequestIdHeader.java deleted file mode 100644 index fe0b517..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/functions/ParseRequestIdHeader.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.azure.management.functions; - -import static org.jclouds.http.HttpUtils.releasePayload; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpResponse; - -import com.google.common.base.Function; - -/** - * Parses an x-ms-request-id the header - * - * A value that uniquely identifies a request made against the management service. For an - * asynchronous operation, you can call get operation status with the value of the header to - * determine whether the operation is complete, has failed, or is still in progress. - */ -@Singleton -public class ParseRequestIdHeader implements Function<HttpResponse, String> { - - public String apply(HttpResponse from) { - releasePayload(from); - String requestId = from.getFirstHeaderOrNull("x-ms-request-id"); - if (requestId != null) { - return requestId; - } - throw new IllegalStateException("did not receive RequestId in: " + from); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/options/CreateHostedServiceOptions.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/options/CreateHostedServiceOptions.java b/azure-management/src/main/java/org/jclouds/azure/management/options/CreateHostedServiceOptions.java deleted file mode 100644 index f33308a..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/options/CreateHostedServiceOptions.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.options; - -import java.util.Map; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import com.google.common.base.Optional; - -/** - * Optional parameters for creating a hosted service - * - * @see <a href="http://msdn.microsoft.com/en-us/library/gg441304" >docs</a> - */ -public class CreateHostedServiceOptions implements Cloneable { - - private Optional<String> description = Optional.absent(); - private Optional<Map<String, String>> extendedProperties = Optional.absent(); - - /** - * @see CreateHostedServiceOptions#getDescription() - */ - public CreateHostedServiceOptions description(String description) { - this.description = Optional.fromNullable(description); - return this; - } - - /** - * @see CreateHostedServiceOptions#getExtendedProperties() - */ - public CreateHostedServiceOptions extendedProperties(Map<String, String> extendedProperties) { - this.extendedProperties = Optional.fromNullable(extendedProperties); - return this; - } - - /** - * A description for the hosted service. The description can be up to 1024 characters in length. - */ - public Optional<String> getDescription() { - return description; - } - - /** - * Represents the name of an extended hosted service property. Each extended property must have - * both a defined name and value. You can have a maximum of 50 extended property name/value - * pairs. - * - * The maximum length of the Name element is 64 characters, only alphanumeric characters and - * underscores are valid in the Name, and the name must start with a letter. Each extended - * property value has a maximum length of 255 characters. - */ - public Optional<Map<String, String>> getExtendedProperties() { - return extendedProperties; - } - - public static class Builder { - - /** - * @see CreateHostedServiceOptions#getDescription() - */ - public static CreateHostedServiceOptions description(String description) { - return new CreateHostedServiceOptions().description(description); - } - - /** - * @see CreateHostedServiceOptions#getExtendedProperties() - */ - public static CreateHostedServiceOptions extendedProperties(Map<String, String> extendedProperties) { - return new CreateHostedServiceOptions().extendedProperties(extendedProperties); - } - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return Objects.hashCode(description, extendedProperties); - } - - @Override - public CreateHostedServiceOptions clone() { - return new CreateHostedServiceOptions().description(description.orNull()).extendedProperties( - extendedProperties.orNull()); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CreateHostedServiceOptions other = CreateHostedServiceOptions.class.cast(obj); - return Objects.equal(this.description, other.description) - && Objects.equal(this.extendedProperties, other.extendedProperties); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return MoreObjects.toStringHelper("").omitNullValues().add("description", description.orNull()) - .add("extendedProperties", extendedProperties.orNull()).toString(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/suppliers/KeyStoreSupplier.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/suppliers/KeyStoreSupplier.java b/azure-management/src/main/java/org/jclouds/azure/management/suppliers/KeyStoreSupplier.java deleted file mode 100644 index c72257b..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/suppliers/KeyStoreSupplier.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.suppliers; - -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; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -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.io.InputSuppliers; -import org.jclouds.location.Provider; - -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 - * the local filesystem. Please look at oauth for examples on how to do this via PEMs. - */ -@Deprecated -@Singleton -public class KeyStoreSupplier implements Supplier<KeyStore> { - private final Crypto crypto; - private final Supplier<Credentials> creds; - - @Inject - KeyStoreSupplier(Crypto crypto, @Provider Supplier<Credentials> creds) { - this.crypto = crypto; - this.creds = creds; - } - - @Override - public KeyStore get() { - Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null"); - String cert = checkNotNull(currentCreds.identity, "credential supplier returned null identity (should be cert)"); - String keyStorePassword = checkNotNull(currentCreds.credential, - "credential supplier returned null credential (should be keyStorePassword)"); - try { - KeyStore keyStore = KeyStore.getInstance("PKCS12"); - - File certFile = new File(checkNotNull(cert)); - if (certFile.isFile()) { // cert is path to pkcs12 file - FileInputStream stream = new FileInputStream(certFile); - try { - keyStore.load(stream, keyStorePassword.toCharArray()); - } finally { - stream.close(); - } - } else { // cert is PEM encoded, containing private key and certs - - // split in private key and certs - int privateKeyBeginIdx = cert.indexOf("-----BEGIN PRIVATE KEY"); - int privateKeyEndIdx = cert.indexOf("-----END PRIVATE KEY"); - String pemPrivateKey = cert.substring(privateKeyBeginIdx, privateKeyEndIdx + 26); - - StringBuilder pemCerts = new StringBuilder(); - int certsBeginIdx = 0; - - do { - certsBeginIdx = cert.indexOf("-----BEGIN CERTIFICATE", certsBeginIdx); - - if (certsBeginIdx >= 0) { - int certsEndIdx = cert.indexOf("-----END CERTIFICATE", certsBeginIdx) + 26; - pemCerts.append(cert.substring(certsBeginIdx, certsEndIdx)); - certsBeginIdx = certsEndIdx; - } - } while (certsBeginIdx != -1); - - // parse private key - KeySpec keySpec = Pems.privateKeySpec(ByteSource.wrap(pemPrivateKey.getBytes(Charsets.UTF_8))); - PrivateKey privateKey = crypto.rsaKeyFactory().generatePrivate(keySpec); - - // populate keystore with private key and certs - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - @SuppressWarnings("unchecked") - Collection<Certificate> certs = (Collection<Certificate>) cf.generateCertificates(new ByteArrayInputStream( - pemCerts.toString().getBytes(Charsets.UTF_8))); - keyStore.load(null); - keyStore.setKeyEntry("dummy", privateKey, keyStorePassword.toCharArray(), - certs.toArray(new java.security.cert.Certificate[0])); - - } - return keyStore; - } catch (NoSuchAlgorithmException e) { - throw propagate(e); - } catch (KeyStoreException e) { - throw propagate(e); - } catch (CertificateException e) { - throw propagate(e); - } catch (FileNotFoundException e) { - throw propagate(e); - } catch (IOException e) { - throw propagate(e); - } catch (InvalidKeySpecException e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/suppliers/SSLContextWithKeysSupplier.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/suppliers/SSLContextWithKeysSupplier.java b/azure-management/src/main/java/org/jclouds/azure/management/suppliers/SSLContextWithKeysSupplier.java deleted file mode 100644 index 7392b70..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/suppliers/SSLContextWithKeysSupplier.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.suppliers; - -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 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 - * the local filesystem. Please look at oauth for examples on how to do this via PEMs. - */ -@Deprecated -@Singleton -public class SSLContextWithKeysSupplier implements Supplier<SSLContext> { - private final Supplier<KeyStore> keyStore; - private final TrustManager[] trustManager; - private final Supplier<Credentials> creds; - - @Inject - SSLContextWithKeysSupplier(Supplier<KeyStore> keyStore, @Provider Supplier<Credentials> creds, HttpUtils utils, - TrustAllCerts trustAllCerts) { - this.keyStore = keyStore; - this.trustManager = utils.trustAllCerts() ? new TrustManager[] { trustAllCerts } : null; - this.creds = creds; - } - - @Override - public SSLContext get() { - Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null"); - String keyStorePassword = checkNotNull(currentCreds.credential, - "credential supplier returned null credential (should be keyStorePassword)"); - KeyManagerFactory kmf; - try { - kmf = KeyManagerFactory.getInstance("SunX509"); - kmf.init(keyStore.get(), keyStorePassword.toCharArray()); - SSLContext sc = SSLContext.getInstance("TLS"); - sc.init(kmf.getKeyManagers(), trustManager, new SecureRandom()); - return sc; - } catch (NoSuchAlgorithmException e) { - throw propagate(e); - } catch (UnrecoverableKeyException e) { - throw propagate(e); - } catch (KeyStoreException e) { - throw propagate(e); - } catch (KeyManagementException e) { - throw propagate(e); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/xml/AttachmentHandler.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/xml/AttachmentHandler.java b/azure-management/src/main/java/org/jclouds/azure/management/xml/AttachmentHandler.java deleted file mode 100644 index 70699d8..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/xml/AttachmentHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.xml; - -import org.jclouds.azure.management.domain.Disk.Attachment; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.util.SaxUtils; -import org.xml.sax.SAXException; - -/** - * @see <a href="http://msdn.microsoft.com/en-us/library/jj157176" >api</a> - */ -public class AttachmentHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Attachment> { - - private StringBuilder currentText = new StringBuilder(); - private Attachment.Builder builder = Attachment.builder(); - - /** - * {@inheritDoc} - */ - @Override - public Attachment getResult() { - try { - return builder.build(); - } finally { - builder = Attachment.builder(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void endElement(String uri, String name, String qName) throws SAXException { - if (qName.equals("HostedServiceName")) { - builder.hostedService(SaxUtils.currentOrNull(currentText)); - } else if (qName.equals("DeploymentName")) { - builder.deployment(SaxUtils.currentOrNull(currentText)); - } else if (qName.equals("RoleName")) { - builder.role(SaxUtils.currentOrNull(currentText)); - } - currentText.setLength(0); - } - - /** - * {@inheritDoc} - */ - @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/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java b/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java deleted file mode 100644 index 68eaf22..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/xml/DeploymentHandler.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.xml; - -import static com.google.common.base.Charsets.UTF_8; -import static com.google.common.io.BaseEncoding.base64; -import static org.jclouds.util.SaxUtils.currentOrNull; -import static org.jclouds.util.SaxUtils.equalsOrSuffix; - -import java.net.URI; -import java.util.List; - -import org.jclouds.azure.management.domain.Deployment; -import org.jclouds.azure.management.domain.DeploymentSlot; -import org.jclouds.azure.management.domain.DeploymentStatus; -import org.jclouds.azure.management.domain.InstanceStatus; -import org.jclouds.azure.management.domain.RoleSize; -import org.jclouds.http.functions.ParseSax; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import com.google.common.collect.Lists; - -/** - * @see <a href="http://msdn.microsoft.com/en-us/library/ee460804" >api</a> - */ -public class DeploymentHandler extends - ParseSax.HandlerForGeneratedRequestWithResult<Deployment> { - - private List<String> elements = Lists.newArrayList(); - protected StringBuilder currentText = new StringBuilder(); - private Deployment.Builder builder = Deployment.builder(); - - /** - * {@inheritDoc} - */ - @Override - public Deployment getResult() { - try { - return builder.build(); - } finally { - builder = Deployment.builder(); - } - } - - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { - elements.add(qName); - } - - /** - * {@inheritDoc} - */ - @Override - public void endElement(String uri, String name, String qName) - throws SAXException { - if (equalsOrSuffix(qName, "Name") && "Deployment".equals(elements.get(elements.size()-2))) { - builder.deploymentName(currentOrNull(currentText)); - } else if (equalsOrSuffix(qName, "DeploymentSlot")) { - final String dpltSlot = currentOrNull(currentText); - if (dpltSlot != null) - builder.deploymentSlot(DeploymentSlot.fromValue(dpltSlot)); - } else if (equalsOrSuffix(qName, "Status")) { - String deploymentStatus = currentOrNull(currentText); - if (deploymentStatus != null) - builder.deploymentStatus(DeploymentStatus - .fromValue(deploymentStatus)); - } else if (equalsOrSuffix(qName, "Label")) { - String label = currentOrNull(currentText); - if (label != null) - builder.deploymentLabel(new String(base64().decode(label), UTF_8)); - } else if (equalsOrSuffix(qName, "Url")) { - final String url = currentOrNull(currentText); - if (url != null) - builder.deploymentURL(URI.create(url)); - } else if (equalsOrSuffix(qName, "RoleName")) { - builder.roleName(currentOrNull(currentText)); - } else if (equalsOrSuffix(qName, "InstanceName")) { - builder.instanceName(currentOrNull(currentText)); - } else if (equalsOrSuffix(qName, "InstanceStatus")) { - String instanceStatus = currentOrNull(currentText); - if (instanceStatus != null) - builder.instanceStatus(InstanceStatus.fromValue(instanceStatus)); - } else if (equalsOrSuffix(qName, "InstanceStateDetails")) { - builder.instanceStateDetails(currentOrNull(currentText)); - } else if (equalsOrSuffix(qName, "InstanceErrorCode")) { - builder.instanceErrorCode(currentOrNull(currentText)); - } else if (equalsOrSuffix(qName, "InstanceSize")) { - String instanceSize = currentOrNull(currentText); - if (instanceSize != null) - builder.instanceSize(RoleSize.fromValue(instanceSize)); - } else if (equalsOrSuffix(qName, "IpAddress")) { - builder.privateIpAddress(currentOrNull(currentText)); - } else if (equalsOrSuffix(qName, "Vip")) { - builder.publicIpAddress(currentOrNull(currentText)); - } - - currentText.setLength(0); - elements.remove(elements.size()-1); - } - - /** - * {@inheritDoc} - */ - @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/6ab58bd2/azure-management/src/main/java/org/jclouds/azure/management/xml/DetailedHostedServicePropertiesHandler.java ---------------------------------------------------------------------- diff --git a/azure-management/src/main/java/org/jclouds/azure/management/xml/DetailedHostedServicePropertiesHandler.java b/azure-management/src/main/java/org/jclouds/azure/management/xml/DetailedHostedServicePropertiesHandler.java deleted file mode 100644 index fef02d7..0000000 --- a/azure-management/src/main/java/org/jclouds/azure/management/xml/DetailedHostedServicePropertiesHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.azure.management.xml; - -import static org.jclouds.util.SaxUtils.currentOrNull; -import static org.jclouds.util.SaxUtils.equalsOrSuffix; - -import javax.inject.Inject; - -import org.jclouds.azure.management.domain.DetailedHostedServiceProperties; -import org.jclouds.azure.management.domain.HostedService.Status; -import org.jclouds.date.DateService; -import org.xml.sax.SAXException; - -/** - * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >api</a> - */ -public class DetailedHostedServicePropertiesHandler extends HostedServicePropertiesHandler { - - protected final DateService dateService; - - @Inject - protected DetailedHostedServicePropertiesHandler(DateService dateService) { - this.dateService = dateService; - } - - private DetailedHostedServiceProperties.Builder<?> builder = DetailedHostedServiceProperties.builder(); - - private String name; - - /** - * {@inheritDoc} - */ - @Override - public DetailedHostedServiceProperties getResult() { - try { - return builder.fromHostedServiceProperties(super.getResult()).build(); - } finally { - builder = DetailedHostedServiceProperties.builder(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void endElement(String uri, String name, String qName) throws SAXException { - if (equalsOrSuffix(qName, "DateCreated")) { - builder.created(dateService.iso8601SecondsDateParse(currentOrNull(currentText))); - } else if (equalsOrSuffix(qName, "DateLastModified")) { - builder.lastModified(dateService.iso8601SecondsDateParse(currentOrNull(currentText))); - } else if (equalsOrSuffix(qName, "Status")) { - String rawStatus = currentOrNull(currentText); - builder.rawStatus(rawStatus); - builder.status(Status.fromValue(rawStatus)); - } else if (equalsOrSuffix(qName, "Name")) { - this.name = currentOrNull(currentText); - } else if (equalsOrSuffix(qName, "Value")) { - builder.addExtendedProperty(this.name, currentOrNull(currentText)); - this.name = null; - } else { - super.endElement(uri, name, qName); - } - currentText.setLength(0); - } - -}
