All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jclouds.azure.management.features.RoleAsyncApi Maven / Gradle / Ivy

/**
 * Licensed to jclouds, Inc. (jclouds) under one or more
 * contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  jclouds 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.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.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.ExceptionParser;
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 org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;

import com.google.common.util.concurrent.ListenableFuture;

/**
 * The Service Management API includes operations for managing the virtual
 * machines in your subscription.
 * 
 * @see docs
 * @see RoleApi
 * @author Gerald Pereira, Adrian Cole
 */
@Headers(keys = "x-ms-version", values = "2012-03-01")
public interface RoleAsyncApi {

	 @GET
	 @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles/{roleName}")
	 @Consumes(MediaType.APPLICATION_ATOM_XML)
	 @JAXBResponseParser
	 @ExceptionParser(ReturnNullOnNotFoundOr404.class)
	 ListenableFuture getRole(@PathParam("serviceName")
	 String serviceName,
	 @PathParam("deploymentName") String deploymentName,
	 @PathParam("roleName") String roleName);

	// This is a PaaS REST service ! => Delete the deployment instead
	// @DELETE
	// @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles/{roleName}")
	// @Consumes(MediaType.APPLICATION_ATOM_XML)
	// @JAXBResponseParser
	// @ExceptionParser(ReturnNullOnNotFoundOr404.class)
	// ListenableFuture deleteRole(@PathParam("serviceName") String
	// serviceName,
	// @PathParam("deploymentName") String deploymentName,
	// @PathParam("roleName") String roleName);

	@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)
	@ExceptionParser(ReturnNullOnNotFoundOr404.class)
	@ResponseParser(ParseRequestIdHeader.class)
	@Payload(value = "RestartRoleOperation")
	ListenableFuture restartRole(
			@PathParam("serviceName") String serviceName,
			@PathParam("deploymentName") String deploymentName,
			@PathParam("roleName") String roleName);

	// This is a PaaS REST service !
	// @POST
	// @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles")
	// @Produces(MediaType.APPLICATION_ATOM_XML)
	// @Consumes(MediaType.TEXT_PLAIN)
	// @ExceptionParser(ReturnNullOnNotFoundOr404.class)
	// ListenableFuture addRole(@PathParam("serviceName") String
	// serviceName,
	// @PathParam("deploymentName") String deploymentName,
	// @BinderParam(BindToXMLPayload.class) PersistentVMRole role);

//	@Deprecated
//	@POST
//	@Path("/services/hostedservices/{serviceName}/deployments")
//	@Produces(MediaType.APPLICATION_ATOM_XML)
//	@Consumes(MediaType.TEXT_PLAIN)
//	@ExceptionParser(ReturnNullOnNotFoundOr404.class)
//	@ResponseParser(ParseRequestIdHeader.class)
//	ListenableFuture createVirtualMachineDeployment(
//			@PathParam("serviceName") String serviceName,
//			@BinderParam(BindToXMLPayload.class) Deployment deployment);

	@POST
	@Path("/services/hostedservices/{serviceName}/deployments")
	@Produces(MediaType.APPLICATION_ATOM_XML)
	@Consumes(MediaType.APPLICATION_ATOM_XML)
	@ExceptionParser(ReturnNullOnNotFoundOr404.class)
	@ResponseParser(ParseRequestIdHeader.class)
	ListenableFuture createDeployment(
			@PathParam("serviceName") String serviceName,
			@BinderParam(BindDeploymentParamsToXmlPayload.class) DeploymentParams deploymentParams);

	@POST
	@Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations")
	@Consumes(MediaType.APPLICATION_ATOM_XML)
	@Produces(MediaType.APPLICATION_ATOM_XML)
	@ExceptionParser(ReturnNullOnNotFoundOr404.class)
	@ResponseParser(ParseRequestIdHeader.class)
	@Payload(value = "CaptureRoleOperationDelete{imageLabel}{imageName}")
	ListenableFuture captureRole(
			@PathParam("serviceName") String serviceName,
			@PathParam("deploymentName") String deploymentName,
			@PathParam("roleName") String roleName,
			@PayloadParam("imageName") String imageName,
			@PayloadParam("imageLabel") String imageLabel);
	
	@POST
	@Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations")
	@Consumes(MediaType.APPLICATION_ATOM_XML)
	@Produces(MediaType.APPLICATION_ATOM_XML)
	@ExceptionParser(ReturnNullOnNotFoundOr404.class)
	@ResponseParser(ParseRequestIdHeader.class)
	@Payload(value = "ShutdownRoleOperation")
	ListenableFuture shutdownRole(
			@PathParam("serviceName") String serviceName,
			@PathParam("deploymentName") String deploymentName,
			@PathParam("roleName") String roleName);
	
	@POST
	@Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations")
	@Consumes(MediaType.APPLICATION_ATOM_XML)
	@Produces(MediaType.APPLICATION_ATOM_XML)
	@ExceptionParser(ReturnNullOnNotFoundOr404.class)
	@ResponseParser(ParseRequestIdHeader.class)
	@Payload(value = "StartRoleOperation")
	ListenableFuture startRole(
			@PathParam("serviceName") String serviceName,
			@PathParam("deploymentName") String deploymentName,
			@PathParam("roleName") String roleName);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy