issue #1184 add named for Azure commands

This commit is contained in:
adriancole 2013-02-02 18:45:33 -08:00
parent 267069755e
commit c517fad22d
7 changed files with 107 additions and 53 deletions

View File

@ -20,6 +20,7 @@ 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;
@ -50,6 +51,10 @@ import com.google.common.util.concurrent.ListenableFuture;
@Headers(keys = "x-ms-version", values = "2012-03-01")
public interface DiskAsyncApi {
/**
* @see DiskApi#list()
*/
@Named("ListDisks")
@GET
@Path("/services/disks")
@XMLResponseParser(ListDisksHandler.class)
@ -57,6 +62,10 @@ public interface DiskAsyncApi {
@Consumes(MediaType.APPLICATION_XML)
ListenableFuture<Set<Disk>> list();
/**
* @see DiskApi#delete
*/
@Named("DeleteDisk")
@DELETE
@Path("/services/disks/{diskName}")
@Fallback(NullOnNotFoundOr404.class)

View File

@ -20,6 +20,7 @@ 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;
@ -66,6 +67,7 @@ public interface HostedServiceAsyncApi {
/**
* @see HostedServiceApi#list()
*/
@Named("ListHostedServices")
@GET
@Path("/services/hostedservices")
@XMLResponseParser(ListHostedServicesHandler.class)
@ -76,6 +78,7 @@ public interface HostedServiceAsyncApi {
/**
* @see HostedServiceApi#createServiceWithLabelInLocation(String, String, String)
*/
@Named("CreateHostedService")
@POST
@Path("/services/hostedservices")
@MapBinder(BindCreateHostedServiceToXmlPayload.class)
@ -88,6 +91,7 @@ public interface HostedServiceAsyncApi {
* @see HostedServiceApi#createServiceWithLabelInLocation(String, String, String,
* CreateHostedServiceOptions)
*/
@Named("CreateHostedService")
@POST
@Path("/services/hostedservices")
@MapBinder(BindCreateHostedServiceToXmlPayload.class)
@ -100,6 +104,7 @@ public interface HostedServiceAsyncApi {
/**
* @see HostedServiceApi#get(String)
*/
@Named("GetHostedServiceProperties")
@GET
@Path("/services/hostedservices/{serviceName}")
@XMLResponseParser(HostedServiceHandler.class)
@ -110,6 +115,7 @@ public interface HostedServiceAsyncApi {
/**
* @see HostedServiceApi#getDetails(String)
*/
@Named("GetHostedServiceProperties")
@GET
@Path("/services/hostedservices/{serviceName}")
@QueryParams(keys = "embed-detail", values = "true")
@ -121,33 +127,28 @@ public interface HostedServiceAsyncApi {
/**
* @see HostedServiceApi#delete(String)
*/
@Named("DeleteHostedService")
@DELETE
@Path("/services/hostedservices/{serviceName}")
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(ParseRequestIdHeader.class)
ListenableFuture<String> delete(@PathParam("serviceName") String serviceName);
// This is a PaaS REST service !
// @POST
// @Path("/services/hostedservices/{serviceName}/deploymentslots/{deploymentSlotName}")
// @Produces(MediaType.APPLICATION_ATOM_XML)
// @Consumes(MediaType.TEXT_PLAIN)
// @Fallback(NullOnNotFoundOr404.class)
// ListenableFuture<Void> createDeployment(@PathParam("serviceName") String serviceName,
// @PathParam("deploymentSlotName") String deploymentSlotName,
// @BinderParam(BindToXMLPayload.class) CreateDeployment createDeployment);
/**
* @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)

View File

@ -20,6 +20,7 @@ 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;
@ -49,6 +50,7 @@ public interface LocationAsyncApi {
/**
* @see LocationApi#list()
*/
@Named("ListLocations")
@GET
@Path("/locations")
@XMLResponseParser(ListLocationsHandler.class)

View File

@ -20,6 +20,7 @@ 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;
@ -58,6 +59,7 @@ public interface OSImageAsyncApi {
/**
* @see OSImageApi#list()
*/
@Named("ListOsImages")
@GET
@Path("/services/images")
@XMLResponseParser(ListOSImagesHandler.class)
@ -68,6 +70,7 @@ public interface OSImageAsyncApi {
/**
* @see OSImageApi#add(String)
*/
@Named("AddOsImage")
@POST
@Path("/services/images")
@Produces(MediaType.APPLICATION_XML)
@ -76,6 +79,7 @@ public interface OSImageAsyncApi {
/**
* @see OSImageApi#update(String)
*/
@Named("UpdateOsImage")
@PUT
@Path("/services/images/{imageName}")
@Produces(MediaType.APPLICATION_XML)
@ -85,6 +89,7 @@ public interface OSImageAsyncApi {
/**
* @see OSImageApi#delete(String)
*/
@Named("DeleteOsImage")
@DELETE
@Path("/services/images/{imageName}")
@Fallback(VoidOnNotFoundOr404.class)

View File

@ -18,6 +18,7 @@
*/
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;
@ -34,7 +35,8 @@ 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.
* 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
@ -43,11 +45,14 @@ import com.google.common.util.concurrent.ListenableFuture;
@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);
}

View File

@ -18,6 +18,7 @@
*/
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;
@ -52,16 +53,22 @@ import com.google.common.util.concurrent.ListenableFuture;
@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);
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
@ -71,21 +78,26 @@ public interface RoleAsyncApi {
@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);
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,
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)
@ -93,13 +105,14 @@ public interface RoleAsyncApi {
@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);
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)
@ -107,11 +120,13 @@ public interface RoleAsyncApi {
@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);
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)
@ -119,9 +134,7 @@ public interface RoleAsyncApi {
@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);
ListenableFuture<String> startRole(@PathParam("serviceName") String serviceName,
@PathParam("deploymentName") String deploymentName, @PathParam("roleName") String roleName);
}

View File

@ -21,6 +21,7 @@ package org.jclouds.azureblob;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import javax.inject.Named;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
@ -93,6 +94,7 @@ public interface AzureBlobAsyncClient {
/**
* @see AzureBlobClient#listContainers
*/
@Named("ListContainers")
@GET
@XMLResponseParser(AccountNameEnumerationResultsHandler.class)
@QueryParams(keys = "comp", values = "list")
@ -101,69 +103,76 @@ public interface AzureBlobAsyncClient {
/**
* @see AzureBlobClient#createContainer
*/
@Named("CreateContainer")
@PUT
@Path("{container}")
@Fallback(FalseIfContainerAlreadyExists.class)
@QueryParams(keys = "restype", values = "container")
ListenableFuture<Boolean> createContainer(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
CreateContainerOptions... options);
/**
* @see AzureBlobClient#getPublicAccessForContainer
*/
@Named("GetContainerACL")
@HEAD
@Path("{container}")
@QueryParams(keys = { "restype", "comp" }, values = { "container", "acl" })
@ResponseParser(ParsePublicAccessHeader.class)
@Fallback(NullOnContainerNotFound.class)
ListenableFuture<PublicAccess> getPublicAccessForContainer(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container);
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
/**
* @see AzureBlobClient#getContainerProperties
*/
@Named("GetContainerProperties")
@HEAD
@Path("{container}")
@QueryParams(keys = "restype", values = "container")
@ResponseParser(ParseContainerPropertiesFromHeaders.class)
@Fallback(NullOnContainerNotFound.class)
ListenableFuture<ContainerProperties> getContainerProperties(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container);
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
/**
* @see AzureBlobClient#containerExists
*/
@Named("GetContainerProperties")
@HEAD
@Path("{container}")
@QueryParams(keys = "restype", values = "container")
@Fallback(FalseOnContainerNotFound.class)
ListenableFuture<Boolean> containerExists(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container);
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
/**
* @see AzureBlobClient#setResourceMetadata
*/
@Named("SetContainerMetadata")
@PUT
@Path("{container}")
@QueryParams(keys = { "restype", "comp" }, values = { "container", "metadata" })
ListenableFuture<Void> setResourceMetadata(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
@BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
/**
* @see AzureBlobClient#deleteContainer
*/
@Named("DeleteContainer")
@DELETE
@Path("{container}")
@Fallback(VoidOnNotFoundOr404.class)
@QueryParams(keys = "restype", values = "container")
ListenableFuture<Void> deleteContainer(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container);
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
/**
* @see AzureBlobClient#createRootContainer
*/
@Named("CreateContainer")
@PUT
@Path("$root")
@Fallback(FalseIfContainerAlreadyExists.class)
@ -173,6 +182,7 @@ public interface AzureBlobAsyncClient {
/**
* @see AzureBlobClient#deleteRootContainer
*/
@Named("DeleteContainer")
@DELETE
@Path("$root")
@Fallback(TrueOnNotFoundOr404.class)
@ -182,17 +192,19 @@ public interface AzureBlobAsyncClient {
/**
* @see AzureBlobClient#listBlobs(String, ListBlobsOptions[])
*/
@Named("ListBlobs")
@GET
@XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
@Path("{container}")
@QueryParams(keys = { "restype", "comp" }, values = { "container", "list" })
ListenableFuture<ListBlobsResponse> listBlobs(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
ListBlobsOptions... options);
/**
* @see AzureBlobClient#listBlobs(ListBlobsOptions[])
*/
@Named("ListBlobs")
@GET
@XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
@Path("$root")
@ -202,63 +214,70 @@ public interface AzureBlobAsyncClient {
/**
* @see AzureBlobClient#putBlob
*/
@Named("PutBlob")
@PUT
@Path("{container}/{name}")
@ResponseParser(ParseETagHeader.class)
ListenableFuture<String> putBlob(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
@PathParam("name") @ParamParser(BlobName.class) @BinderParam(BindAzureBlobMetadataToRequest.class) org.jclouds.azureblob.domain.AzureBlob object);
/**
* @see AzureBlobClient#getBlob
*/
@Named("GetBlob")
@GET
@ResponseParser(ParseBlobFromHeadersAndHttpContent.class)
@Fallback(NullOnKeyNotFound.class)
@Path("{container}/{name}")
ListenableFuture<org.jclouds.azureblob.domain.AzureBlob> getBlob(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
@PathParam("name") String name, GetOptions... options);
/**
* @see AzureBlobClient#getBlobProperties
*/
@Named("GetBlobProperties")
@HEAD
@ResponseParser(ParseBlobPropertiesFromHeaders.class)
@Fallback(NullOnKeyNotFound.class)
@Path("{container}/{name}")
ListenableFuture<BlobProperties> getBlobProperties(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
@PathParam("name") String name);
/**
* @see AzureBlobClient#blobExists
*
*/
@Named("GetBlobProperties")
@HEAD
@Fallback(FalseOnKeyNotFound.class)
@Path("{container}/{name}")
ListenableFuture<Boolean> blobExists(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
@PathParam("name") String name);
/**
* @see AzureBlobClient#setBlobMetadata
*/
@Named("SetBlobMetadata")
@PUT
@Path("{container}/{name}")
@QueryParams(keys = { "comp" }, values = { "metadata" })
ListenableFuture<Void> setBlobMetadata(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
@PathParam("name") String name, @BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
/**
* @see AzureBlobClient#deleteBlob
*/
@Named("DeleteBlob")
@DELETE
@Fallback(VoidOnNotFoundOr404.class)
@Path("{container}/{name}")
ListenableFuture<Void> deleteBlob(
@PathParam("container") @ParamValidators( { ContainerNameValidator.class }) String container,
@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
@PathParam("name") String name);
}