mirror of https://github.com/apache/jclouds.git
Issue 830: Add missing operations to Org clients
This commit is contained in:
parent
78a4a674ab
commit
235ed12337
|
@ -18,18 +18,25 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CONTROL_ACCESS;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
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 org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
|
@ -62,6 +69,28 @@ public interface OrgAsyncClient {
|
|||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<? extends Org> getOrg(@EndpointParam URI orgUri);
|
||||
|
||||
/**
|
||||
* @see OrgClient#modifyControlAccess(URI, URI, ControlAccessParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/catalog/{catalogId}/action/controlAccess")
|
||||
@Produces(CONTROL_ACCESS)
|
||||
@Consumes(CONTROL_ACCESS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<ControlAccessParams> modifyControlAccess(@EndpointParam URI orgURI, @PathParam("catalogId") String catalogId,
|
||||
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
|
||||
|
||||
/**
|
||||
* @see OrgClient#getControlAccess(URI, URI, ControlAccessParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/catalog/{catalogId}/controlAccess")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<ControlAccessParams> getControlAccess(@EndpointParam URI orgURI, @PathParam("catalogId") String catalogId);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
|
||||
|
@ -59,6 +59,28 @@ public interface OrgClient {
|
|||
*/
|
||||
Org getOrg(URI orgRef);
|
||||
|
||||
/**
|
||||
* Modifies a catalog control access.
|
||||
*
|
||||
* <pre>
|
||||
* POST /org/{id}/catalog/{catalogId}/action/controlAccess
|
||||
* </pre>
|
||||
*
|
||||
* @return the control access information
|
||||
*/
|
||||
ControlAccessParams modifyControlAccess(URI orgRef, String catalogId, ControlAccessParams params);
|
||||
|
||||
/**
|
||||
* Retrieves the catalog control access information.
|
||||
*
|
||||
* <pre>
|
||||
* GET /org/{id}/catalog/{catalogId}/controlAccess
|
||||
* </pre>
|
||||
*
|
||||
* @return the control access information
|
||||
*/
|
||||
ControlAccessParams getControlAccess(URI orgRef, String catalogId);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,7 @@ import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata;
|
|||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValue;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOrg;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkReferenceType;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
@ -32,6 +33,7 @@ import static org.testng.Assert.assertNotNull;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
|
@ -142,4 +144,19 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
checkMetadataValue(value);
|
||||
assertEquals(value.getValue(), expected, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, value.getValue()));
|
||||
}
|
||||
|
||||
@Test(testName = "GET /org/{id}/catalog/{catalogId}/controlAccess")
|
||||
public void testGetontrolAccess() {
|
||||
String catalogId = "";
|
||||
ControlAccessParams params = orgClient.getControlAccess(orgURI, catalogId);
|
||||
checkControlAccessParams(params);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testGetontrolAccess" })
|
||||
public void testModifyControlAccess() {
|
||||
String catalogId = "";
|
||||
ControlAccessParams params = orgClient.getControlAccess(orgURI, catalogId);
|
||||
ControlAccessParams modified = orgClient.modifyControlAccess(orgURI, catalogId, params);
|
||||
checkControlAccessParams(modified);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue