update client to use references and get metadata value

This commit is contained in:
danikov 2012-02-21 11:19:35 +00:00
parent 9ce2004365
commit 8e30658078
3 changed files with 16 additions and 16 deletions

View File

@ -28,9 +28,9 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
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.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint; import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
@ -46,33 +46,33 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface NetworkAsyncClient { public interface NetworkAsyncClient {
/** /**
* @see NeworkClient#getNetwork(ReferenceType) * @see NeworkClient#getNetwork(Reference)
*/ */
@GET @GET
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> networkRef); ListenableFuture<OrgNetwork> getNetwork(@EndpointParam(parser = ReferenceToEndpoint.class) Reference networkRef);
/** /**
* @see NeworkClient#getMetadata(ReferenceType) * @see NeworkClient#getMetadata(Reference)
*/ */
@GET @GET
@Path("/metadata") @Path("/metadata")
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> networkRef); ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference networkRef);
/** /**
* @see NeworkClient#getMetadataEntry(ReferenceType, String) * @see NeworkClient#getMetadataValue(Reference, String)
*/ */
@GET @GET
@Path("/metadata/{key}") @Path("/metadata/{key}")
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> networkRef , ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) Reference networkRef ,
@PathParam("key") String key); @PathParam("key") String key);
} }

View File

@ -22,9 +22,9 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
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.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; import org.jclouds.vcloud.director.v1_5.domain.Reference;
/** /**
* Provides synchronous access to Network. * Provides synchronous access to Network.
@ -42,20 +42,20 @@ public interface NetworkClient {
* *
* @return the network or null if not found * @return the network or null if not found
*/ */
OrgNetwork getNetwork(ReferenceType<?> networkRef); OrgNetwork getNetwork(Reference networkRef);
/** /**
* Retrieves an list of the network's metadata * Retrieves an list of the network's metadata
* *
* @return a list of metadata * @return a list of metadata
*/ */
Metadata getMetadata(ReferenceType<?> networkRef); Metadata getMetadata(Reference networkRef);
/** /**
* Retrieves a metadata entry * Retrieves a metadata value
* *
* @return the metadata entry, or null if not found * @return the metadata value, or null if not found
*/ */
MetadataEntry getMetadataEntry(ReferenceType<?> networkRef, String key); MetadataValue getMetadataValue(Reference networkRef, String key);
} }

View File

@ -181,7 +181,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
Reference networkRef = Reference.builder().href(networkUri).build(); Reference networkRef = Reference.builder().href(networkUri).build();
assertEquals(client.getNetworkClient().getMetadataEntry(networkRef, "KEY"), expected); assertEquals(client.getNetworkClient().getMetadataValue(networkRef, "KEY"), expected);
} }
public static OrgNetwork orgNetwork() { public static OrgNetwork orgNetwork() {