public interface VcdClient extends JaxRsClient
JaxRsClient with behaviors specific to the vCloud REST API.| Modifier and Type | Interface and Description |
|---|---|
static interface |
VcdClient.ClientRequestIdProvider
Returns client request ID to use when making request to VCD.
|
static interface |
VcdClient.Query<QueryResultClass>
Represents a query which can be executed against VCD.
|
static class |
VcdClient.QueryListPage<T>
A generic class to store the
List of items of the specified class, which are returned by
a typed query, and the total number of matching items, which might be greater than the number of
items returned. |
static interface |
VcdClient.ReferenceTypeChangedCallBack
A callback contract to inform the caller that
a href value has been repaired.
|
static interface |
VcdClient.SessionToken
|
JaxRsClient.ErrorHandlerEMPTY_CONTENTS| Modifier and Type | Method and Description |
|---|---|
<ResponseClass> |
deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType ref,
Boolean force,
Boolean recursive,
Class<ResponseClass> responseClass)
Convenience wrapper over {@link JaxRsClient#deleteResource(java.net.URI, Class).
|
<ResponseClass> |
deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType ref,
Class<ResponseClass> responseClass)
Convenience wrapper over {@link JaxRsClient#deleteResource(java.net.URI, Class).
|
<ResponseClass> |
deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
Boolean force,
Boolean recursive,
Class<ResponseClass> responseClass)
Deletes the resource described by the specified resource type.
|
<ResponseClass> |
deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType ref,
Class<ResponseClass> responseClass)
Convenience wrapper over {@link JaxRsClient#deleteResource(java.net.URI, Class).
|
VcdClient |
duplicate(boolean newSession)
Creates a clone of current
VcdClient
The new client will communicate with the same vCD as this client and is initialized with same
credentials and CxfClientSecurityContext. |
com.vmware.vcloud.api.rest.schema_v1_5.VCloudType |
getAdmin()
Returns the "admin" root resource type.
|
com.vmware.vcloud.api.rest.schema_v1_5.ApiExtensibilityType |
getApiExtensibility()
Returns the Api Extensibility object
|
String |
getClientApiVersion()
Gets the API version used by the client for vCloud API requests
|
<T extends com.vmware.vcloud.api.rest.schema_v1_5.EntityType> |
getEntity(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType referenceType,
Class<T> resourceClass,
VcdClient.ReferenceTypeChangedCallBack referenceTypeChangedCallBack)
Get an entity using a
ReferenceType by first trying with its href and, when it fails,
trying to recover using the vcd entity resolver service. |
<ResponseClass extends com.vmware.vcloud.api.rest.schema_v1_5.EntityType> |
getEntity(String entityId,
String mediaType,
Class<ResponseClass> responseClass)
Resolve a vCloud entity using its identifier and then fetch the corresponding vCloud entity instance.
|
EventViewer |
getEventViewer() |
com.vmware.vcloud.api.rest.schema_v1_5.extension.VMWExtensionType |
getExtension()
Returns the "extension" root resource type.
|
String |
getJwtToken()
Get the current JWT for this client.
|
com.vmware.vcloud.api.rest.schema_v1_5.AdminOrgType |
getLoggedInAdminOrg()
Returns info about the admin view of the org, the session is logged in as (if permitted).
|
com.vmware.vcloud.api.rest.schema_v1_5.OrgType |
getLoggedInOrg()
Returns info about the org the session is logged in as.
|
NsxProxyApiClient |
getNsxProxyApiClient()
Returns an NsxProxyApiClient (which continues to use the existing session).
|
OpenApiClient |
getOpenApiClient()
Returns an OpenApiClient (which continues to use the existing session).
|
List<com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType> |
getOrganizations()
Gets the organizations defined/accessible in the vCloud server.
|
com.vmware.vcloud.api.rest.schema.ovf.ObjectFactory |
getOvfObjectFactory()
Returns an object factory for OVF schema classes.
|
com.vmware.vcloud.api.rest.schema.ovf.vmware.ObjectFactory |
getOvfVmwareObjectFactory()
Returns an object factory VMware-specific OVF schema classes.
|
<QueryResultClass> |
getPackagedQuery(String packagedQueryPath,
Class<QueryResultClass> queryResultClass)
Returns an instance of the
VcdClient.Query object for a packaged query and query
result type. |
<QueryResultClass> |
getQuery(String queryTypeName,
Class<QueryResultClass> queryResultClass)
Returns an instance of the
VcdClient.Query object for the given query type name and query
result type. |
com.vmware.vcloud.api.rest.schema_v1_5.QueryListType |
getQueryList()
Returns the list of supported queries.
|
<ResourceClass> |
getResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType ref,
Class<ResourceClass> resourceClass)
Convenience wrapper over
JaxRsClient.getResource(java.net.URI, Class). |
<ResourceClass extends com.vmware.vcloud.api.rest.schema_v1_5.ResourceType> |
getResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
Class<ResourceClass> resourceClass)
Gets the contents of the resource referenced by its href
|
<ResourceClass> |
getResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
RelationType rel,
String mediaType,
Class<ResourceClass> resourceClass)
Gets the contents of the resource referenced by the link with the specified rel
and mediaType in the specified resource.
|
javax.ws.rs.core.Response |
getServerStatus()
Retrieves the current server status from the
api/server_status endpoint, adjusting
the Accept headers as needed. |
com.vmware.vcloud.api.rest.schema_v1_5.SessionType |
getSession()
Returns the
SessionType for the current session |
VcdClient.SessionToken |
getSessionToken()
Get the current opaque session token for this client.
|
com.vmware.vcloud.api.rest.schema_v1_5.MultisiteSessionUserInfoType |
getSessionUserInfo()
Returns the
MultisiteSessionUserInfoType for the current session's user |
VcdTaskMonitor |
getTaskMonitor()
Returns task monitor, which can be used to monitor specific task returned by POST or PUT
requests.
|
com.vmware.vcloud.api.rest.schema_v1_5.extension.ObjectFactory |
getVCloudExtensionObjectFactory()
Returns an object factory for vCD Extension API schema classes.
|
com.vmware.vcloud.api.rest.schema_v1_5.ObjectFactory |
getVCloudObjectFactory()
Returns an object factory for vCD API schema classes.
|
com.vmware.vcloud.api.rest.schema.versioning.SupportedVersionsType |
getVersions()
Gets information about the vCloud API versions supported by the server.
|
void |
login(ClientCredentials credentials)
Deprecated.
|
void |
loginWithJwt(String jwt,
String orgIdSecurityContext)
Reuses an existing session on the remote vCloud API end point using the supplied JWT taken
from another
VcdClient. |
void |
loginWithToken(VcdClient.SessionToken sessionToken)
Reuses an existing session on the remote vCloud API end point using the supplied session
token taken from another
VcdClient. |
void |
logout()
Logs out of the remote vCloud API end point
|
<ContentsClass,ResponseClass> |
postResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType reference,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Convenience wrapper over
JaxRsClient.postResource(java.net.URI, String, JAXBElement, Class) |
<ContentsClass,ResponseClass> |
postResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
RelationType rel,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Posts the contents to the resource referenced by the link with the specified rel and
mediaType in the specified resource
|
<ContentsClass,ResponseClass> |
putResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType reference,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Convenience wrapper over {@link JaxRsClient#putResource(java.net.URI, String, JAXBElement, Class)
|
<ContentsClass,ResponseClass> |
putResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
RelationType rel,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Puts the contents to the resource referenced by the link with the specified rel and
mediaType in the specified resource
|
<ContentsClass extends com.vmware.vcloud.api.rest.schema_v1_5.ResourceType,ResponseClass> |
putResource(String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
Like
putResource(ReferenceType, String, JAXBElement, Class) except constrains
the type of the contents parameter to be a type that has an href field and assumes that field
has been populated (which, for example, it will naturally if was returned by a getResource call and then
modified for use in this call). |
void |
relogin()
Repeats login if client credentials are present.
|
javax.ws.rs.core.Response |
removeResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource)
Deletes the resource described by the specified resource type.
|
<ResponseClass> |
removeResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
Boolean force,
Boolean recursive,
Class<ResponseClass> responseClass)
Deletes the resource described by the specified resource type.
|
com.vmware.vcloud.api.rest.schema_v1_5.EntityType |
resolveEntityById(String id)
Returns information about the resource with the specified ID.
|
void |
setAuthenticationHeader(org.apache.cxf.jaxrs.client.Client client)
Sets the vCloud API authentication header in the specified JAX-RS
Client object
to be the one for this VcdClient. |
void |
setClientRequestIdProvider(VcdClient.ClientRequestIdProvider clientRequestIdProvider) |
void |
setCredentials(ClientCredentials credentials)
Sets the credentials used for authentication.
|
void |
setMultisiteRequests(boolean federateRequests)
Controls whether requests made with this client request federated behavior or not.
|
void |
setOrgContextHeader(String orgContext)
Sets the X-VMWARE-VCLOUD-ORG-ID header to the specified value
|
createProxy, createWebClient, createWebClient, deleteResource, deleteResource, deleteResourceVoid, getEndpoint, getResource, getResource, optionsResource, postResource, postResource, postResourceVoid, putFile, putResource, putResource, putResourceVoid, setErrorHandlercom.vmware.vcloud.api.rest.schema.versioning.SupportedVersionsType getVersions()
String getClientApiVersion()
@Deprecated void login(ClientCredentials credentials)
void relogin()
void setCredentials(ClientCredentials credentials)
void loginWithToken(VcdClient.SessionToken sessionToken)
VcdClient.sessionToken - An opaque token which represents an existing session from a VcdClientvoid loginWithJwt(String jwt, String orgIdSecurityContext)
VcdClient.jwt - A JWT which represents an existing session from a VcdClientorgIdSecurityContext - orgId of the org security context to make the request in. Used for Multisite
requests. Pass null to use issuing org as the context.void logout()
VcdClient duplicate(boolean newSession) throws VcdErrorException
VcdClient
The new client will communicate with the same vCD as this client and is initialized with same
credentials and CxfClientSecurityContext. The session may or may not be shared amond
the 2 sessions.newSession - true if a new session should be created in the cloned client,
false if both clients must share the sessionVcdClientVcdErrorException - if there were errors while initializing the cloned clientvoid setClientRequestIdProvider(VcdClient.ClientRequestIdProvider clientRequestIdProvider)
clientRequestIdProvider - VcdClient.ClientRequestIdProvider to use to populate client request ID in requests
to VCDVcdClient.SessionToken getSessionToken()
VcdClient to an existing logged in session.null if there is none.String getJwtToken()
VcdClient to an
existing logged in session and for making a request to a different, associated, org.null if there is none.javax.ws.rs.core.Response getServerStatus()
api/server_status endpoint, adjusting
the Accept headers as needed.Response object containing response and http status code returned by the
call.<ResourceClass> ResourceClass getResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType ref,
Class<ResourceClass> resourceClass)
JaxRsClient.getResource(java.net.URI, Class).<T extends com.vmware.vcloud.api.rest.schema_v1_5.EntityType> T getEntity(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType referenceType,
Class<T> resourceClass,
VcdClient.ReferenceTypeChangedCallBack referenceTypeChangedCallBack)
ReferenceType by first trying with its href and, when it fails,
trying to recover using the vcd entity resolver service.
This method tolerates a ReferenceType instance where ReferenceType.getHref()
might return null or an invalid href. When the href is invalid or null, an attempt is made at
resolving a new href in order to GET the entity. This attempt is made possible by using the
API endpoint associated to this VcdClient and the entity identifier set in the passed
ReferenceType. The assumption is that the user of this API may persists the href of entities for
some period of time, while the vCloud API endpoint may be changed independently later on.
When an attempt to recover the entity href is successful, the
passed VcdClient.ReferenceTypeChangedCallBack is invoked with the new href as a parameter.
In the context of this method, an invalid href is defined has a URL on which an HTTP GET fails, this happens when for example a href is:
referenceType - a ReferenceType of the entity to getresourceClass - a specialized EntityType classreferenceTypeChangedCallBack - a VcdClient.ReferenceTypeChangedCallBackEntityType corresponding to the given ReferenceType<ResourceClass extends com.vmware.vcloud.api.rest.schema_v1_5.ResourceType> ResourceClass getResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
Class<ResourceClass> resourceClass)
ResourceClass - JAXB-generated class of the linked-to resourceresource - the resource with the linkresourceClass - JAXB-generated class of the linked-to resource<ResourceClass> ResourceClass getResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
RelationType rel,
String mediaType,
Class<ResourceClass> resourceClass)
ResourceClass - JAXB-generated class of the linked-to resourceresource - the resource with the linkrel - the rel of the desired linkmediaType - media type of contentresourceClass - JAXB-generated class of the linked-to resource<ContentsClass,ResponseClass> ResponseClass putResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType reference,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
<ContentsClass extends com.vmware.vcloud.api.rest.schema_v1_5.ResourceType,ResponseClass> ResponseClass putResource(String mediaType, JAXBElement<ContentsClass> contents, Class<ResponseClass> responseClass)
putResource(ReferenceType, String, JAXBElement, Class) except constrains
the type of the contents parameter to be a type that has an href field and assumes that field
has been populated (which, for example, it will naturally if was returned by a getResource call and then
modified for use in this call).ContentsClass - JAXB-generated class of the request contentsResponseClass - JAXB-generated class of the responsemediaType - media type of the contentcontents - the contents to put; contents.getHref() must be valid and identify the resource to be modifiedresponseClass - JAXB-generated class of the response<ContentsClass,ResponseClass> ResponseClass putResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
RelationType rel,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
throws VcdErrorException
ContentsClass - JAXB-generated class of the request contentsResponseClass - JAXB-generated class of the responseresource - the resource with the linkrel - the rel of the desired linkmediaType - media type of contentcontents - the contents to be putresponseClass - JAXB-generated class of the responseVcdErrorException - put request completes with error.<ContentsClass,ResponseClass> ResponseClass postResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType reference,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
JaxRsClient.postResource(java.net.URI, String, JAXBElement, Class)<ContentsClass,ResponseClass> ResponseClass postResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
RelationType rel,
String mediaType,
JAXBElement<ContentsClass> contents,
Class<ResponseClass> responseClass)
throws VcdErrorException
ContentsClass - JAXB-generated class of the request contentsResponseClass - JAXB-generated class of the responseresource - the resource with the linkrel - the rel of the desired linkmediaType - media type of contentcontents - the contents to be postresponseClass - JAXB-generated class of the responseVcdErrorException - post request completes with error.<ResponseClass> ResponseClass deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType ref,
Class<ResponseClass> responseClass)
<ResponseClass> ResponseClass deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType ref,
Class<ResponseClass> responseClass)
ref - responseClass - javax.ws.rs.core.Response removeResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource)
throws VcdErrorException
RelationType.REMOVE)
in the specified resource type (whose associated URL might or might not be the same as the value of
the resource type's "href" field).VcdErrorException - delete request completes with error.<ResponseClass> ResponseClass deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType ref,
Boolean force,
Boolean recursive,
Class<ResponseClass> responseClass)
ref - force - forces the resource to be deleted without regard to its state; child objects will
not be removed unless recursive delete is also asserted; null
indicates that this parameter will be omittedrecursive - recursively removes this resource and its children; null indicates that
this parameter will be omittedresponseClass - <ResponseClass> ResponseClass deleteResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
Boolean force,
Boolean recursive,
Class<ResponseClass> responseClass)
ResourceType itself.resource - force - forces the resource to be deleted without regard to its state; child objects will
not be removed unless recursive delete is also asserted; null
indicates that this parameter will be omittedrecursive - recursively removes this resource and its children; null indicates that
this parameter will be omittedresponseClass - <ResponseClass> ResponseClass removeResource(com.vmware.vcloud.api.rest.schema_v1_5.ResourceType resource,
Boolean force,
Boolean recursive,
Class<ResponseClass> responseClass)
RelationType.REMOVE)
in the specified resource type (whose associated URL might or might not be the same as the value of
the resource type's "href" field).resource - force - forces the resource to be deleted without regard to its state; child objects will
not be removed unless recursive delete is also asserted; null
indicates that this parameter will be omittedrecursive - recursively removes this resource and its children; null indicates that
this parameter will be omittedresponseClass - List<com.vmware.vcloud.api.rest.schema_v1_5.ReferenceType> getOrganizations()
VCloudClient#login
must be called prior to calling this method.IllegalStateException - if called when not logged incom.vmware.vcloud.api.rest.schema_v1_5.OrgType getLoggedInOrg()
IllegalStateException - if called when not logged incom.vmware.vcloud.api.rest.schema_v1_5.AdminOrgType getLoggedInAdminOrg()
MissingLinkException - if link is unavailable because the user may not have access to it.com.vmware.vcloud.api.rest.schema_v1_5.SessionType getSession()
SessionType for the current sessionIllegalStateException - if called when not logged incom.vmware.vcloud.api.rest.schema_v1_5.MultisiteSessionUserInfoType getSessionUserInfo()
MultisiteSessionUserInfoType for the current session's userIllegalStateException - if called when not logged incom.vmware.vcloud.api.rest.schema_v1_5.VCloudType getAdmin()
IllegalStateException - if called when not logged inOpenApiClient getOpenApiClient()
NsxProxyApiClient getNsxProxyApiClient()
com.vmware.vcloud.api.rest.schema_v1_5.extension.VMWExtensionType getExtension()
IllegalStateException - if called when not logged incom.vmware.vcloud.api.rest.schema_v1_5.QueryListType getQueryList()
IllegalStateException - if called when not logged incom.vmware.vcloud.api.rest.schema_v1_5.ApiExtensibilityType getApiExtensibility()
IllegalStateException - if called when not logged incom.vmware.vcloud.api.rest.schema_v1_5.EntityType resolveEntityById(String id)
The class of the returned value corresponds to the media-type 'application/vnd.vmware.vcloud.entity',
this means it's a strict instance of {link EntityType}, and not a specialization of EntityType.
Note that to fetch an entity and cast it to its specialized JAXB binding the methods
#getEntity(ReferenceType, Class) and getEntity(ReferenceType, Class, ReferenceTypeChangedCallBack)
are available.
id - the unique identifier of the entity to resolveEntityTypeIllegalStateException - if called when not logged in#getEntity(ReferenceType, Class),
getEntity(ReferenceType, Class, ReferenceTypeChangedCallBack)<ResponseClass extends com.vmware.vcloud.api.rest.schema_v1_5.EntityType> ResponseClass getEntity(String entityId, String mediaType, Class<ResponseClass> responseClass)
entityId - the vCloud entity identifier to use to resolve the entitymediaType - the media type corresponding to this entityresponseClass - the JAXB generated binding corresponding to the returned resultEntityType instance cast to its specific JAXB bindingresolveEntityById(String),
getEntity(ReferenceType, Class, ReferenceTypeChangedCallBack)com.vmware.vcloud.api.rest.schema_v1_5.ObjectFactory getVCloudObjectFactory()
com.vmware.vcloud.api.rest.schema_v1_5.extension.ObjectFactory getVCloudExtensionObjectFactory()
com.vmware.vcloud.api.rest.schema.ovf.ObjectFactory getOvfObjectFactory()
com.vmware.vcloud.api.rest.schema.ovf.vmware.ObjectFactory getOvfVmwareObjectFactory()
VcdTaskMonitor getTaskMonitor()
EventViewer getEventViewer()
EventViewer.void setMultisiteRequests(boolean federateRequests)
federateRequests - void setAuthenticationHeader(org.apache.cxf.jaxrs.client.Client client)
Client object
to be the one for this VcdClient.IllegalStateException - if called when not logged invoid setOrgContextHeader(String orgContext)
<QueryResultClass> VcdClient.Query<QueryResultClass> getQuery(String queryTypeName, Class<QueryResultClass> queryResultClass)
VcdClient.Query object for the given query type name and query
result type.queryTypeName - Query type namequeryResultClass - Type of query results. Must be ReferenceType or a type derived from
QueryResultRecordType.VcdClient.Query object<QueryResultClass> VcdClient.Query<QueryResultClass> getPackagedQuery(String packagedQueryPath, Class<QueryResultClass> queryResultClass)
VcdClient.Query object for a packaged query and query
result type.packagedQueryPath - packaged query path in the format /{package}/queryqueryResultClass - Type of query results. Must be ReferenceType or a type derived from
QueryResultRecordType.VcdClient.Query objectCopyright © 2019 VMware. All rights reserved.