private void validateConnection(ContainerHostSpec hostSpec, Operation op) { EndpointCertificateUtil.validateSslTrust(this, hostSpec, op, () -> { fetchSslTrustAliasProperty(hostSpec, () -> { pingHost(hostSpec, op, hostSpec.sslTrust, () -> completeOperationSuccess(op)); }); }); }
private void validateVicHost(ContainerHostSpec hostSpec, Operation op) { String computeAddress = hostSpec.hostState.address; EndpointCertificateUtil.validateSslTrust(this, hostSpec, op, () -> { fetchSslTrustAliasProperty(hostSpec, () -> { getHostInfo(hostSpec, op, hostSpec.sslTrust, (computeState) -> { if (ContainerHostUtil.isVicHost(computeState)) { logInfo("VIC host verification passed for %s", computeAddress); completeOperationSuccess(op); } else { logInfo("VIC host verification failed for %s", computeAddress); op.fail(new LocalizableValidationException( CONTAINER_HOST_IS_NOT_VCH_MESSAGE, CONTAINER_HOST_IS_NOT_VCH_MESSAGE_CODE)); } }); }); }); }
private void updateHost(ContainerHostSpec hostSpec, Operation op) { fetchSslTrustAliasProperty(hostSpec, () -> { ComputeState cs = hostSpec.hostState; sendRequest(Operation.createPut(this, cs.documentSelfLink) .setBody(cs) .setCompletion((o, e) -> { if (e != null) { op.fail(e); return; } createHostPortProfile(cs, op); // when host is updated and ssl property cannot be fetch (power state is // UNKNOWN) do not run data collection (DC) to avoid endless loop. DC will // check for the ssl property and send new update for the host, and so on. if (ComputeService.PowerState.UNKNOWN != hostSpec.hostState.powerState) { // run data collection only if there's no error getting its certificate updateContainerHostInfo(cs.documentSelfLink); triggerEpzEnumeration(); } })); }); }
private void createHost(ContainerHostSpec hostSpec, Operation op) { fetchSslTrustAliasProperty(hostSpec, () -> { if (hostSpec.acceptHostAddress) { if (hostSpec.acceptCertificate) { Operation o = Operation.createGet(null) .setCompletion((completedOp, e) -> { if (e != null) { storeHost(hostSpec, op); } else { op.setStatusCode(completedOp.getStatusCode()); op.transferResponseHeadersFrom(completedOp); op.setBodyNoCloning(completedOp.getBodyRaw()); op.complete(); } }); EndpointCertificateUtil .validateSslTrust(this, hostSpec, o, () -> storeHost(hostSpec, op)); } else { storeHost(hostSpec, op); } } else { EndpointCertificateUtil .validateSslTrust(this, hostSpec, op, () -> storeHost(hostSpec, op)); } }); }