mirror of
https://github.com/apache/jclouds.git
synced 2025-02-16 15:08:28 +00:00
add roleReferenceQuery variation
This commit is contained in:
parent
13cf27cd0f
commit
f25fb0807f
@ -46,7 +46,8 @@ import com.google.common.base.Objects.ToStringHelper;
|
|||||||
*/
|
*/
|
||||||
@XmlSeeAlso({
|
@XmlSeeAlso({
|
||||||
VAppReference.class,
|
VAppReference.class,
|
||||||
CatalogReference.class
|
CatalogReference.class,
|
||||||
|
RoleReference.class
|
||||||
})
|
})
|
||||||
@XmlRootElement(name = "Reference")
|
@XmlRootElement(name = "Reference")
|
||||||
@XmlType(name = "ReferenceType")
|
@XmlType(name = "ReferenceType")
|
||||||
@ -114,7 +115,7 @@ public class Reference {
|
|||||||
return new Reference(this);
|
return new Reference(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected B fromReference(Reference in) {
|
public B fromReference(Reference in) {
|
||||||
return href(in.getHref()).id(in.getId()).name(in.getName()).type(in.getType());
|
return href(in.getHref()).id(in.getId()).name(in.getName()).type(in.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* 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.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "RoleReference")
|
||||||
|
public class RoleReference extends Reference {
|
||||||
|
|
||||||
|
public static Builder<?> builder() {
|
||||||
|
return new ConcreteBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder<?> toBuilder() {
|
||||||
|
return builder().fromRoleReference(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder<B extends Builder<B>> extends Reference.Builder<B> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RoleReference build() {
|
||||||
|
return new RoleReference(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected B fromRoleReference(RoleReference in) {
|
||||||
|
return fromReference(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleReference(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleReference(URI href, String id, String name, String type) {
|
||||||
|
super(href, id, name, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RoleReference() {
|
||||||
|
// For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
RoleReference that = RoleReference.class.cast(o);
|
||||||
|
return super.equals(that);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE hashcode inheritted from Reference
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
/**
|
||||||
|
* 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.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultReferences;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Container for ReferenceType elements that reference RoleType objects.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* <p>Java class for RoleReferences complex type.
|
||||||
|
*
|
||||||
|
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <complexType name="RoleReferences">
|
||||||
|
* <complexContent>
|
||||||
|
* <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
|
||||||
|
* <sequence>
|
||||||
|
* <element name="RoleReference" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
|
||||||
|
* </sequence>
|
||||||
|
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||||
|
* </extension>
|
||||||
|
* </complexContent>
|
||||||
|
* </complexType>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "RoleReferences")
|
||||||
|
public class RoleReferences extends QueryResultReferences {
|
||||||
|
|
||||||
|
public static Builder<?> builder() {
|
||||||
|
return new ConcreteBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder<?> toBuilder() {
|
||||||
|
return builder().fromRoleReferences(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder<B extends Builder<B>> extends QueryResultReferences.Builder<B> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RoleReferences build() {
|
||||||
|
return new RoleReferences(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public B fromRoleReferences(RoleReferences in) {
|
||||||
|
return fromQueryResultReferences(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RoleReferences(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RoleReferences() {
|
||||||
|
// for JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
RoleReferences that = RoleReferences.class.cast(o);
|
||||||
|
return super.equals(that);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE hashcode inheritted from QueryResultReferences
|
||||||
|
|
||||||
|
}
|
@ -28,7 +28,9 @@ import javax.ws.rs.QueryParam;
|
|||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
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.QueryParams;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||||
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.ThrowVCloudErrorOn4xx;
|
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||||
@ -101,6 +103,14 @@ public interface AdminQueryAsyncClient extends QueryAsyncClient {
|
|||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<QueryResultRecords> rolesQuery(@QueryParam("filter") String filter);
|
ListenableFuture<QueryResultRecords> rolesQuery(@QueryParam("filter") String filter);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/admin/roles/query")
|
||||||
|
@Consumes
|
||||||
|
@QueryParams(keys = { "format" }, values = { "references" })
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<RoleReferences> roleReferencesQueryAll();
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/admin/strandedUsers/query")
|
@Path("/admin/strandedUsers/query")
|
||||||
@Consumes
|
@Consumes
|
||||||
|
@ -25,6 +25,7 @@ import javax.management.relation.Role;
|
|||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Group;
|
import org.jclouds.vcloud.director.v1_5.domain.Group;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.User;
|
import org.jclouds.vcloud.director.v1_5.domain.User;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
||||||
@ -95,6 +96,17 @@ public interface AdminQueryClient extends QueryClient {
|
|||||||
/** @see #queryAll() */
|
/** @see #queryAll() */
|
||||||
QueryResultRecords rolesQuery(String filter);
|
QueryResultRecords rolesQuery(String filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of {@link RoleReference}s by using REST API general QueryHandler.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* GET /admin/roles/query?format=references
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @see #rolesQueryAll(String)
|
||||||
|
*/
|
||||||
|
RoleReferences roleReferencesQueryAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of {@link User}s by using REST API general QueryHandler.
|
* Retrieves a list of {@link User}s by using REST API general QueryHandler.
|
||||||
*
|
*
|
||||||
|
@ -21,6 +21,8 @@ package org.jclouds.vcloud.director.v1_5.features;
|
|||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultAdminUserRecord;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultAdminUserRecord;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultAdminVdcRecord;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultAdminVdcRecord;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
||||||
@ -92,6 +94,12 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||||||
Checks.checkQueryResultRecord(record);
|
Checks.checkQueryResultRecord(record);
|
||||||
assertEquals(record.getClass(), QueryResultRoleRecord.class, "incorrect record type admin query");
|
assertEquals(record.getClass(), QueryResultRoleRecord.class, "incorrect record type admin query");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RoleReferences roleRefs = queryClient.roleReferencesQueryAll();
|
||||||
|
|
||||||
|
for (Reference ref : roleRefs.getReferences()) {
|
||||||
|
Checks.checkReferenceType(ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /admin/strandedUsers/query")
|
@Test(testName = "GET /admin/strandedUsers/query")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user