add the rest of the methods

This commit is contained in:
danikov 2012-02-09 19:43:35 +00:00
parent 9730649e32
commit 2b87e865d0
2 changed files with 83 additions and 6 deletions

View File

@ -21,18 +21,23 @@ package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import java.net.URI;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.Media; import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -53,6 +58,23 @@ public interface MediaAsyncClient {
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Media> getMedia(@EndpointParam URI mediaRef); ListenableFuture<Media> getMedia(@EndpointParam URI mediaRef);
/**
* @see MediaClient#updateMedia()
*/
@PUT
@Consumes
@JAXBResponseParser
ListenableFuture<Task> updateMedia(@EndpointParam URI mediaRef,
@PayloadParam("Media") Media media);
/**
* @see MediaClient#deleteMedia()
*/
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Void> deleteMedia(@EndpointParam URI mediaRef);
/** /**
* @see MediaClient#getMedia() * @see MediaClient#getMedia()
*/ */
@ -72,6 +94,15 @@ public interface MediaAsyncClient {
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam URI mediaRef); ListenableFuture<Metadata> getMetadata(@EndpointParam URI mediaRef);
/**
* @see MediaClient#updateMetadata()
*/
@POST
@Consumes
@JAXBResponseParser
ListenableFuture<Task> updateMetadata(@EndpointParam URI mediaRef,
@PayloadParam("Metadata") Metadata metadata);
/** /**
* @see MediaClient#getMetadataEntry() * @see MediaClient#getMetadataEntry()
@ -81,4 +112,22 @@ public interface MediaAsyncClient {
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam URI metaDataRef); ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam URI metaDataRef);
/**
* @see MediaClient#updateMedia()
*/
@PUT
@Consumes
@JAXBResponseParser
ListenableFuture<Task> updateMetadataEntry(@EndpointParam URI metaDataRef,
@PayloadParam("MetadataEntry") MetadataEntry metadataEntry);
/**
* @see MediaClient#deleteMetadataEntry()
*/
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Void> deleteMetadataEntry(@EndpointParam URI metaDataRef);
} }

View File

@ -26,6 +26,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Task;
/** /**
* Provides synchronous access to Media. * Provides synchronous access to Media.
@ -45,6 +46,19 @@ public interface MediaClient {
*/ */
Media getMedia(URI mediaRef); Media getMedia(URI mediaRef);
/**
* Updates the name/description of a media.
*
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task updateMedia(URI mediaRef, Media media);
/**
* Deletes a media.
*/
void deleteMedia(URI mediaRef);
/** /**
* Retrieves an owner. * Retrieves an owner.
* *
@ -58,6 +72,13 @@ public interface MediaClient {
* @return a list of metadata * @return a list of metadata
*/ */
Metadata getMetadata(URI mediaRef); Metadata getMetadata(URI mediaRef);
/**
* Merges the metadata for a media with the information provided.
*
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task updateMetadata(URI mediaRef, Metadata metadata);
/** /**
* Retrieves a metadata entry * Retrieves a metadata entry
@ -66,11 +87,18 @@ public interface MediaClient {
*/ */
MetadataEntry getMetadataEntry(URI metaDataRef); MetadataEntry getMetadataEntry(URI metaDataRef);
// TODO /**
// PUT /media/{id} Updates the name/description of a media. * Sets the metadata for the particular key for the media to the value provided
// DELETE /media/{id} Deletes a media. *
// POST /media/{id}/metadata Merges the metadata for a media with the information provided. * @return a task. This operation is asynchronous and the user should monitor the returned
// PUT /media/{id}/metadata/{key} Sets the metadata for the particular key for the media to the value provided. * task status in order to check when it is completed.
// DELETE /media/{id}/metadata/{key} Deletes the metadata for the particular key for the media */
Task updateMetadataEntry(URI metaDataRef, MetadataEntry metadataEntry);
/**
* Deletes a metadata entry.
*/
void deleteMetadataEntry(URI metaDataRef);
} }