@Override protected void validateStateOnStart(ClosureRemovalTaskState state) throws IllegalArgumentException { assertNotEmpty(state.resourceLinks, "resourceLinks"); }
private void validateStateOnStart(CompositeComponent state) { assertNotEmpty(state.name, "name"); }
@Override protected void validateStateOnStart(CompositionTaskState state) { assertNotEmpty(state.resourceDescriptionLink, "resourceDescriptionLink"); }
private void validate(ConfigurationState state) { assertNotEmpty(state.key, "key"); assertNotEmpty(state.value, "value"); }
public ProjectRolesHandler(Service service, String projectLink) { AssertUtil.assertNotNull(service, "service"); AssertUtil.assertNotEmpty(projectLink, "projectLink"); this.service = service; this.projectLink = projectLink; }
private Map<String, HostSelection> filterHostsByType( PlacementHostSelectionTaskState state, ComponentDescription desc, Map<String, HostSelection> initHostSelectionMap) { List<ContainerHostType> supportedHostTypes = getSupportedHostTypes(state, desc); AssertUtil.assertNotEmpty(supportedHostTypes, "supportedHostTypes"); Map<String, HostSelection> map = initHostSelectionMap.entrySet().stream() .filter(e -> supportedHostTypes.contains(e.getValue().hostType)) .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); return map; }
@Override protected void validateStateOnStart(PKSClusterRemovalTaskState task) throws IllegalArgumentException { AssertUtil.assertNotNull(task, "task"); AssertUtil.assertNotEmpty(task.resourceLink, "resourceLink"); }
public static void assertNotNullOrEmpty(String value, String propertyName) { assertNotNull(value, propertyName); assertNotEmpty(value, propertyName); }
@Override protected void validateStateOnStart(PKSClusterResizeTaskState task) throws IllegalArgumentException { AssertUtil.assertNotNull(task, "task"); AssertUtil.assertNotEmpty(task.resourceLink, "resourceLink"); AssertUtil.assertNotNull(task.customProperties, "customProperties"); AssertUtil.assertNotEmpty(task.getCustomProperty(PKS_WORKER_INSTANCES_FIELD), "customProperties [" + PKS_WORKER_INSTANCES_FIELD + "]"); }
public static void assertComponentTypes( Map<String, ComponentTemplate<?>> components) { assertNotEmpty(components, "components"); Set<String> yamlLiterals = Stream.of(ResourceType.getValues()) .map(type -> type.getContentType()) .collect(Collectors.toSet()); components.forEach((componentName, component) -> { if (!yamlLiterals.contains(component.type)) { String errorMessage = String.format("Component '%s' has an unsupported type '%s'", componentName, component.type); throw new LocalizableValidationException(errorMessage, "compute.template.components.unsupported.type", componentName, component.type); } }); }
public static String generateFingerprint(SslTrustCertificateState body) { AssertUtil.assertNotEmpty(body.certificate, "certificate"); return CertificateUtil .generatePureFingerPrint(CertificateUtil.createCertificateChain(body.certificate)); }
protected ServiceTaskCallback(String serviceSelfLink, TaskStage taskStageComplete, Enum<?> subStageComplete, TaskStage taskStageFailed, Enum<?> subStageFailed) { assertNotEmpty(serviceSelfLink, "serviceSelfLink"); assertNotNull(taskStageComplete, "taskStageComplete"); assertNotNull(taskStageFailed, "taskStageFailed"); this.serviceSelfLink = serviceSelfLink; this.taskStageComplete = taskStageComplete; this.taskStageFailed = taskStageFailed; this.subStageComplete = subStageComplete; this.subStageFailed = subStageFailed; }
private void validateCompositeTemplate(CompositeTemplate compositeTemplate) { assertNotNull(compositeTemplate, "compositeTemplate"); assertNotEmpty(compositeTemplate.name, "name"); assertComponentTypes(compositeTemplate.components); }
@Override protected void validateStateOnStart(PKSProvisioningTaskState task) throws IllegalArgumentException { AssertUtil.assertNotNull(task, "task"); AssertUtil.assertNotNull(task.customProperties, "customProperties"); AssertUtil.assertNotEmpty(task.getCustomProperty(PKS_CLUSTER_NAME_PROP_NAME), "customProperties [" + PKS_CLUSTER_NAME_PROP_NAME + "]"); AssertUtil.assertNotEmpty(task.getCustomProperty(PKS_PLAN_NAME_FIELD), "customProperties [" + PKS_PLAN_NAME_FIELD + "]"); AssertUtil.assertNotEmpty(task.getCustomProperty(PKS_MASTER_HOST_FIELD), "customProperties [" + PKS_MASTER_HOST_FIELD + "]"); AssertUtil.assertNotNullOrEmpty(task.endpointLink, "endpointLink"); AssertUtil.assertNotNull(task.tenantLinks, "tenantLinks"); AssertUtil.assertNotEmpty(TenantLinksUtil.getProjectAndGroupLinks(task.tenantLinks), "tenantLinks(project/group links only)"); }
private void validateStateOnStart(SslTrustCertificateState state) throws Exception { assertNotEmpty(state.certificate, "certificate"); state.certificate = state.certificate.trim(); X509Certificate[] certificates = CertificateUtil.createCertificateChain(state.certificate); CertificateUtil.validateCertificateChain(certificates); // Populate the certificate properties based on the first (end server) certificate X509Certificate endCertificate = certificates[0]; SslTrustCertificateState.populateCertificateProperties(state, endCertificate); }
public static DockerCompose deserializeDockerCompose(String yaml) throws IOException { assertNotEmpty(yaml, "yaml"); DockerCompose entity; try { entity = YamlMapper.objectMapper().readValue(yaml.trim(), DockerCompose.class); } catch (JsonProcessingException e) { throw new LocalizableValidationException( "Error processing Docker Compose v2 YAML content: " + e.getOriginalMessage(), "compute.template.yaml.compose2.error", e.getOriginalMessage()); } sanitizeDockerCompose(entity); return entity; }
public SubscriptionManager(ServiceHost host, String uniqueSubscriptionId, String subscribeForServiceLink, Class<T> type, boolean useSubscriptionPollingStrategy) { AssertUtil.assertNotNull(host, "serviceHost"); AssertUtil.assertNotEmpty(subscribeForServiceLink, "subscribeForServiceLink"); AssertUtil.assertNotNull(type, "type"); AssertUtil.assertNotNull(uniqueSubscriptionId, "uniqueSubscriptionId"); this.host = host; this.type = type; this.uniqueSubscriptionId = uniqueSubscriptionId; this.subscribeForServiceLink = subscribeForServiceLink; this.subscribeForNotifications = useSubscriptionPollingStrategy ? !SUBSCRIPTION_POLLING_STRATEGY : true; this.documentQuery = new ServiceDocumentQuery<T>(host, type); }
@Override public void handleGet(Operation get) { Map<String, String> queryParams = UriUtils.parseUriQueryParams(get.getUri()); String requestId = queryParams.remove(QUERY_PARAM); String host = queryParams.remove(HOST_PARAM); AssertUtil.assertNotEmpty(requestId, QUERY_PARAM); List<TaskServiceDocumentHistoryInternal> foundTasks = new ArrayList<>(); retrieveAllFromContext(requestId, host, foundTasks, (ex) -> { if (ex != null) { get.fail(ex); } else { RequestBrokerGraphResponse r = new RequestBrokerGraphResponse(); r.tasks = convert(foundTasks); populateRequestInfos(r, r.tasks, requestId); get.setBody(r); get.complete(); } }); }
@Override public void handleGet(Operation get) { AssertUtil.assertNotNull(MockDockerVolumeListService.volumesList, "MockDockerVolumeListService.volumesList"); AssertUtil.assertNotEmpty(MockDockerVolumeListService.volumesList, "MockDockerVolumeListService.volumesList"); VolumeItem volumeItem = MockDockerVolumeListService.volumesList.get(0); get.setBody(volumeItem); get.complete(); }
public void validate() { AssertUtil.assertNotNullOrEmpty(endpointLink, FIELD_NAME_ENDPOINT_LINK); AssertUtil.assertNotNull(cluster, FIELD_NAME_CLUSTER); AssertUtil.assertNotNull(cluster.uuid, "cluster.uuid"); AssertUtil.assertNotNull(cluster.name, "cluster.name"); AssertUtil.assertNotNull(getExternalAddress(), "external-hostname"); AssertUtil.assertNotEmpty(tenantLinks, FIELD_NAME_TENANT_LINKS); }