See: Description
| Interface | Description |
|---|---|
| ClientCredentials |
Abstract credentials for use in authenticating REST/HTTP sessions.
|
| EventViewer |
Helper methods to search for events.
|
| OpenApiClient |
REST API client built on OpenAPI framework.
|
| TaskMonitor |
Monitors tasks for success or failure returned by post and put methods in
JaxRsClient. |
| VcdClient |
A vCloud REST API client.
|
| VcdClient.ClientRequestIdProvider |
Returns client request ID to use when making request to VCD.
|
| VcdClient.Query<QueryResultClass> |
Represents a query which can be executed against VCD.
|
| VcdClient.ReferenceTypeChangedCallBack |
A callback contract to inform the caller that
a href value has been repaired.
|
| VcdClient.SessionToken | |
| VcdTaskMonitor |
VCD specific enhancement for
TaskMonitor. |
| VcdTaskMonitor.MultiTaskTracker |
A monitor for many tasks that will eventually report the final
TaskStatus of each
task identified by the task URN |
| Class | Description |
|---|---|
| NsxProxyApiClient |
A client to interact with VCD's NSX/networking proxy API.
|
| TaskMonitorImpl | |
| VcdBasicLoginCredentials |
Username@Org/password Credentials suitable for use in authenticating with a vCD server using the
vCloud API
|
| VcdBearerLoginCredentials |
Bearer Token credentials suitable for use in authenticating with a vCD server using the
vCloud API.
|
| 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. |
| VcdClientImpl | |
| VcdClientImpl.SessionTokenImpl |
Implementation of
SessionToken to represent a current session with vCD. |
| VcdMultisiteLoginCredentials |
Certificate based credentials for signing the body of a multisite request.
|
| VcdSignLoginCredentials |
Saml Token/Org-name credentials suitable for use in authenticating with a vCD server using the
vCloud API
|
| VcdUtils |
Miscellaneous utility methods for use when working with
VcdClients. |
| XStreamXmlProvider |
JAX-RS's Provider to handle XStream in XML format.
|
| Enum | Description |
|---|---|
| QueryResultFormat |
Form of result returned by a query.
|
| TaskStatus |
The status of a task
Note: This Enum is clone of
com.vmware.vcloud.api.presentation.entity.common.TaskStatus. |
| Exception | Description |
|---|---|
| LinkException |
Base class for exceptions related to operations on <link> elements in responses.
|
| MissingLinkException |
An exception to indicate that a resource being queried for a <link> element of
a particular rel and media type in fact has no such link.
|
| MissingRecordException |
An exception to indicate that a query failed to return an expected record.
|
| MultipleLinksException |
An exception to indicate that a resource being queried for a single <link> element of
a particular rel and media type in fact has multiple matching such elements.
|
| MultipleRecordsException |
An exception to indicate that a query returned more than one record when it was
expected to return exactly one record.
|
| VcdErrorException |
Base exception to represent errors returned by VCD.
|
| VcdErrorResponseException |
Exception for encapsulating errors returned by VCD as Jaxb
ErrorType object |
| VcdErrorResponseProcessingException |
Exception to note that error returned by VCD cannot be processed.
|
| VcdTaskException |
Exception thrown when task failed to complete.
|
The starting point for all accesses is the VcdClient.
Vcd Client
==========
The supplied concrete implementation (VcdClientImpl)
provides the necessary implementation and is correctly initialized using vCloud Director XML
Schemas and can handle the necessary marshalling/un This class serves as a java version of an
HTTP request tool (a-la Postman) customized to ensure correct communication with vCloud Director
by managing the necessary session, API versioning and other vCloud Director specific state. Once
correctly instantiated it allows the user to make the necessary HTTP calls (GET,
PUT, POST and DELETE ). The response can be a returned as raw
Response object or a parsed JAXBElement utilizing
its familiarity with vCloud Director schema.
The client provides further support for interpreting REST navigational links embedded in each response to speedily make subsequent calls and allows exploring the entire data model in a RESTful fashion.
Usage examples:
TBA
Open API Client
===============
An Open API client interacts with vCloud Director's endpoint that serves functionality using the
OpenAPI specification. This client supports both JAX-RS and RESTful calls to
VCD's /cloudapi endpoints
Unlike VcdClientImpl, which is directly instantiated,
an instance of OpenApiClientImpl can only be
acquired from VcdClient#getOpenApiClient() call. This ensures that both client's share
the necessary authentication and other internal state. Once initialized, this client is aware of
vCloud Director's OpenAPI compliant API definitions and manages the generation of necessary Java
JAX-RS stubs, serialization and de-serialization of JSON model objects and other HTTP compliance.
Usage examples: For each of the following examples, ApiModel represents the data
communicated with vCD via ApiInterface which provides the necessary CRUD methods for the
model. ApiInterface is assumed to be appropriately annotated with necessary JAX-RS
annotations.
final OpenApiClient openApiClient = authenticatedVcdClient.getOpenApiClient();
final ApiInterface api = openApiClient.createProxy(ApiInterface.class);
final ApiModel model = api.getApiModel();
// model.update();
final ApiModel updatedModel = api.putModel(model);
All necessary headers will be configured as per the presence of
@Produces/@ConsumesClient supplied conveniences to override headers as required.
final OpenApiClient openApiClient = authenticatedVcdClient.getOpenApiClient();
final ApiInterface api = openApiClient.createProxy(ApiInterface.class);
// Get hold of CXF Web
final Client clientForCurrentCall = openApiClient.getWebClientForNextCall(api);
client.accept("*/*");
final ApiModel model = api.getApiModel();
CXF wire logging confirms that the Accept header used is */* instead of the
value specified in the @Consumes annotation for the getter.Response is also accessed via the CXF
Client that must be retrieved before invoking the
API call. After the call completes, Client.getResponse() will
have the raw Response object that was received by the underlying JAX-RS
framework
final OpenApiClient openApiClient = authenticatedVcdClient.getOpenApiClient();
final ApiInterface api = openApiClient.createProxy(ApiInterface.class);
// Get hold of CXF Web
final Client clientForCurrentCall = openApiClient.getWebClientForNextCall(api);
final ApiModel model = api.getApiModel();
// Retrieve the response and verify the status code.
final Response response = clientForCurrentCall.getResponse();
System.out.println("Response status code: " + response.getStatus());
Java method than a client implementation
final OpenApiClient openApiClient = authenticatedVcdClient.getOpenApiClient();
final ApiInterface api = openApiClient.createProxy(ApiInterface.class);
// Get
final ApiModel model = api.getApiModel();
// Invoke a task
final byte[] binaryData = getSomeData();
final Client clientForTask = openApiClient.getWebClientForNextCall(api);
clientForTask.accept(MediaType.APPLICATION_OCTET_STREAM);
final TaskModel task = api.postAction(model, binaryData);
final Response taskResponse = clientForTask.getResponse();
Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED);
// Update
model.setXYZ(newXyz);
final ApiModel updatedModel = api.putModel(model);
// And finally delete
final Client clientForDelete = openApiClient.getWebClientForNextCall(api);
api.deleteModel(updatedModel); // returns void.
final Response taskResponse = clientForDelete.getResponse();
Assert.assertEquals(response.getStatus(), Response.Status.NO_CONTENT);
As can be seen, the same interface proxy can be used for any number of calls. Underlying client
will ensure any Client-based customization is reset between calls.Copyright © 2019 VMware. All rights reserved.