private boolean isClusteringOperation(RequestBrokerState state) { return RequestBrokerState.CLUSTER_RESOURCE_OPERATION.equals(state.operation) || state.getCustomProperty(RequestUtils.CLUSTERING_OPERATION_CUSTOM_PROP) != null; }
private boolean isAllocationOperation(RequestBrokerState state) { return isProvisionOperation(state) && Boolean.TRUE.toString() .equals(state.getCustomProperty(RequestUtils.FIELD_NAME_ALLOCATION_REQUEST)); }
task.endpointLink = state.getCustomProperty(PKSConstants.PKS_ENDPOINT_PROP_NAME); task.clusterName = state.getCustomProperty(PKSConstants.PKS_CLUSTER_NAME_PROP_NAME); task.resourceLink = state.resourceLinks.iterator().next(); task.tenantLinks = state.tenantLinks;
clusteringState.resourceType = state.resourceType; clusteringState.documentDescription = state.documentDescription; clusteringState.contextId = state.getCustomProperty(FIELD_NAME_CONTEXT_ID_KEY);
private void createPKSClusterProvisioningTask(RequestBrokerState state) { String link = buildUriPath(PKSClusterProvisioningTaskService.FACTORY_LINK, getSelfId()); createNewIfNotExist(link, () -> { PKSProvisioningTaskState task = new PKSProvisioningTaskState(); task.documentSelfLink = getSelfId(); task.serviceTaskCallback = ServiceTaskCallback.create( state.documentSelfLink, TaskStage.STARTED, SubStage.COMPLETED, TaskStage.STARTED, SubStage.REQUEST_FAILED); task.customProperties = state.customProperties; task.preferMasterIP = Boolean.parseBoolean(task .removeCustomProperty(PKSConstants.PKS_PREFER_MASTER_IP_PROP_NAME)); task.endpointLink = state.getCustomProperty(PKSConstants.PKS_ENDPOINT_PROP_NAME); task.tenantLinks = state.tenantLinks; task.requestTrackerLink = state.requestTrackerLink; // calculate task expiration to be shortly before parent task expiration task.documentExpirationTimeMicros = calculatePKSTaskExpirationTime(state); sendRequest(Operation .createPost(this, PKSClusterProvisioningTaskService.FACTORY_LINK) .setBodyNoCloning(task) .setContextId(getSelfId()) .setCompletion((o, e) -> { if (e != null) { failTask("Failure in creating PKS resource provision task", e); return; } })); }); }