private DeferredResult<List<String>> collectTrustCert(ContainerHostRemovalTaskState state) { List<DeferredResult<String>> a = state.resourceLinks.stream().map(resourceLink -> sendWithDeferredResult(Operation .createGet(this, resourceLink), ComputeState.class) .thenApply(o -> PropertyUtils .getPropertyString(o.customProperties, ComputeConstants.HOST_TRUST_CERTS_PROP_NAME) .orElse(null)) ).collect(Collectors.toList()); return DeferredResult.allOf(a); }
static String namespacePrefix(KubernetesContext context, KubernetesDescription description, String apiVersionPrefix) { // If there is a namespace in the description, use it if (description != null && description.namespace != null && !description.namespace.isEmpty()) { return namespacePrefix(context, description.namespace, apiVersionPrefix); } // Otherwise, use the namespace stored in the k8s context // or default to the default namespace String namespace = KubernetesHostConstants.KUBERNETES_HOST_DEFAULT_NAMESPACE; if (context.host != null && context.host.customProperties != null) { namespace = PropertyUtils .getPropertyString(context.host.customProperties, KubernetesHostConstants.KUBERNETES_HOST_NAMESPACE_PROP_NAME) .orElse(namespace); } return namespacePrefix(context, namespace, apiVersionPrefix); }
map.put(ContainerHostService.CONTAINER_HOST_TYPE_PROP_NAME, hostType.name()); map.put(ComputeConstants.HOST_AUTH_CREDENTIALS_PROP_NAME, PropertyUtils.getPropertyString(hostSpec.hostState.customProperties, ComputeConstants.HOST_AUTH_CREDENTIALS_PROP_NAME) .orElse(null)); map.put(ContainerHostService.HOST_PUBLIC_ADDRESS_PROP_NAME, PropertyUtils.getPropertyString(hostSpec.hostState.customProperties, ContainerHostService.HOST_PUBLIC_ADDRESS_PROP_NAME) .orElse(null)); map.put(ContainerHostService.CUSTOM_PROPERTY_DEPLOYMENT_POLICY, PropertyUtils.getPropertyString(hostSpec.hostState.customProperties, ContainerHostService.CUSTOM_PROPERTY_DEPLOYMENT_POLICY) .orElse(null)); map.put(ContainerHostService.CUSTOM_PROPERTY_HOST_ALIAS, PropertyUtils.getPropertyString(hostSpec.hostState.customProperties, ContainerHostService.CUSTOM_PROPERTY_HOST_ALIAS) .orElse(null)); map.put(PKS_ENDPOINT_PROP_NAME, PropertyUtils.getPropertyString(hostSpec.hostState.customProperties, PKS_ENDPOINT_PROP_NAME) .orElse(null)); map.put(PKS_CLUSTER_NAME_PROP_NAME, PropertyUtils.getPropertyString(hostSpec.hostState.customProperties, PKS_CLUSTER_NAME_PROP_NAME) .orElse(null)); map.put(PKS_CLUSTER_UUID_PROP_NAME, PropertyUtils.getPropertyString(hostSpec.hostState.customProperties, PKS_CLUSTER_UUID_PROP_NAME) .orElse(null));
ClusterService.CLUSTER_CREATION_TIME_MICROS_CUSTOM_PROP) .orElse(0L); ePZClusterDto.details = PropertyUtils.getPropertyString(resourcePoolState.customProperties, ClusterService.CLUSTER_DETAILS_CUSTOM_PROP).orElse(""); ePZClusterDto.totalMemory = resourcePoolState.maxMemoryBytes == null ? 0 : ClusterType.DOCKER; ePZClusterDto.type = ClusterType .valueOf(PropertyUtils.getPropertyString(resourcePoolState.customProperties, ClusterService.CLUSTER_TYPE_CUSTOM_PROP) .orElse(type.toString()));
private void queryComputes(Operation op, PKSCluster[] pksClusters, String endpointLink) { QueryTask.Query endpointClause = new QueryTask.Query() .setTermPropertyName(QuerySpecification.buildCompositeFieldName( ResourceState.FIELD_NAME_CUSTOM_PROPERTIES, PKS_ENDPOINT_PROP_NAME)) .setTermMatchValue(endpointLink); QueryTask queryTask = QueryUtil.buildQuery(ComputeState.class, true, endpointClause); QueryUtil.addExpandOption(queryTask); Set<String> uuids = new HashSet<>(); new ServiceDocumentQuery<>(getHost(), ComputeState.class) .query(queryTask, (r) -> { if (r.hasException()) { logSevere("Failed to query for compute states with endpoint link [%s]: %s", endpointLink, Utils.toString(r.getException())); op.fail(r.getException()); } else if (r.hasResult()) { String uuid = PropertyUtils.getPropertyString( r.getResult().customProperties, PKS_CLUSTER_UUID_PROP_NAME) .orElse(null); if (uuid != null) { uuids.add(uuid); } } else { processHosts(op, uuids, pksClusters); } }); }
private DeferredResult<QueryTask> doRemoveTrustCerts(RegistryState rs) { .getPropertyString(rs.customProperties, REGISTRY_TRUST_CERTS_PROP_NAME) .orElse(null);