use of com.vmware.photon.controller.model.support.CertificateInfoServiceErrorResponse in project photon-model by vmware.
the class EndpointAllocationTaskService method validateCredentials.
private void validateCredentials(EndpointAllocationTaskState currentState, SubStage next) {
EndpointConfigRequest req = new EndpointConfigRequest();
req.requestType = RequestType.VALIDATE;
req.endpointProperties = currentState.endpointState.endpointProperties;
req.tenantLinks = currentState.tenantLinks;
req.checkForEndpointUniqueness = currentState.checkForEndpointUniqueness;
if (currentState.endpointState.documentSelfLink != null) {
req.resourceReference = UriUtils.extendUri(ClusterUtil.getClusterUri(getHost(), ServiceTypeCluster.INVENTORY_SERVICE), currentState.endpointState.documentSelfLink);
}
req.isMockRequest = currentState.options.contains(TaskOption.IS_MOCK);
Operation.createPatch(currentState.adapterReference).setBody(req).setCompletion((o, e) -> {
if (e != null) {
logWarning(() -> e.getMessage());
sendFailurePatch(this, currentState, e);
return;
}
EndpointAllocationTaskState st = createUpdateSubStageTask(next);
if (o.hasBody() && currentState.taskSubStage == SubStage.VALIDATE_CREDENTIALS) {
CertificateInfoServiceErrorResponse errorResponse = o.getBody(CertificateInfoServiceErrorResponse.class);
if (CertificateInfoServiceErrorResponse.KIND.equals(errorResponse.documentKind)) {
st.taskInfo.failure = errorResponse;
st.taskInfo.stage = TaskStage.FAILED;
if (errorResponse.certificateInfo != null) {
st.certificateInfo = errorResponse.certificateInfo;
}
}
}
sendSelfPatch(st);
}).sendWith(this);
}
Aggregations