public void computeAndValidateWriteIndex() { List<IndexMetaData> writeIndices = referenceIndexMetaDatas.stream() .filter(idxMeta -> Boolean.TRUE.equals(idxMeta.getAliases().get(aliasName).writeIndex())) .collect(Collectors.toList()); if (writeIndices.isEmpty() && referenceIndexMetaDatas.size() == 1 && referenceIndexMetaDatas.get(0).getAliases().get(aliasName).writeIndex() == null) { writeIndices.add(referenceIndexMetaDatas.get(0)); } if (writeIndices.size() == 1) { writeIndex.set(writeIndices.get(0)); } else if (writeIndices.size() > 1) { List<String> writeIndicesStrings = writeIndices.stream() .map(i -> i.getIndex().getName()).collect(Collectors.toList()); throw new IllegalStateException("alias [" + aliasName + "] has more than one write index [" + Strings.collectionToCommaDelimitedString(writeIndicesStrings) + "]"); } } }
private void sendContentTypeErrorMessage(RestRequest restRequest, RestChannel channel) throws IOException { final List<String> contentTypeHeader = restRequest.getAllHeaderValues("Content-Type"); final String errorMessage; if (contentTypeHeader == null) { errorMessage = "Content-Type header is missing"; } else { errorMessage = "Content-Type header [" + Strings.collectionToCommaDelimitedString(restRequest.getAllHeaderValues("Content-Type")) + "] is not supported"; } channel.sendResponse(BytesRestResponse.createSimpleErrorResponse(channel, NOT_ACCEPTABLE, errorMessage)); }
+ Strings.collectionToCommaDelimitedString(duplicates)+ "]");
"node does not contain the awareness attribute [%s]; required attributes cluster setting [%s=%s]", awarenessAttribute, CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.getKey(), allocation.debugDecision() ? Strings.collectionToCommaDelimitedString(awarenessAttributes) : null);
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("User[username=").append(username); sb.append(",roles=[").append(Strings.collectionToCommaDelimitedString(roles)).append("]"); sb.append(",metadata=").append(metadata); sb.append(",fullName=").append(fullName); sb.append(",email=").append(email); sb.append("]"); return sb.toString(); }
/** * Get all gatherers in the registry and announce them to the node service. */ public void announceGatherers() { nodeService.putAttribute(GathererConstants.GATHERER_MODULES, Strings.collectionToCommaDelimitedString(registry.getGatherers().keySet())); }
void setAllowMethods(final HttpResponse response) { Set<String> strMethods = new HashSet<>(); for (HttpMethod method : config.allowedRequestMethods()) { strMethods.add(method.getName().trim()); } response.headers().set(ACCESS_CONTROL_ALLOW_METHODS, Strings.collectionToCommaDelimitedString(strMethods)); }
@Override public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException { builder.startObject(); builder.field(DatafeedConfig.ID.getPreferredName(), Strings.collectionToCommaDelimitedString(datafeedIds)); if (allowNoDatafeeds != null) { builder.field(ALLOW_NO_DATAFEEDS.getPreferredName(), allowNoDatafeeds); } builder.endObject(); return builder; }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); builder.field(Job.ID.getPreferredName(), Strings.collectionToCommaDelimitedString(jobIds)); if (allowNoJobs != null) { builder.field(ALLOW_NO_JOBS.getPreferredName(), allowNoJobs); } builder.endObject(); return builder; } }
private void sendContentTypeErrorMessage(RestRequest restRequest, RestChannel channel) throws IOException { final List<String> contentTypeHeader = restRequest.getAllHeaderValues("Content-Type"); final String errorMessage; if (contentTypeHeader == null) { errorMessage = "Content-Type header is missing"; } else { errorMessage = "Content-Type header [" + Strings.collectionToCommaDelimitedString(restRequest.getAllHeaderValues("Content-Type")) + "] is not supported"; } channel.sendResponse(BytesRestResponse.createSimpleErrorResponse(channel, NOT_ACCEPTABLE, errorMessage)); }
private void sendContentTypeErrorMessage(RestRequest restRequest, RestChannel channel) throws IOException { final List<String> contentTypeHeader = restRequest.getAllHeaderValues("Content-Type"); final String errorMessage; if (contentTypeHeader == null) { errorMessage = "Content-Type header is missing"; } else { errorMessage = "Content-Type header [" + Strings.collectionToCommaDelimitedString(restRequest.getAllHeaderValues("Content-Type")) + "] is not supported"; } channel.sendResponse(BytesRestResponse.createSimpleErrorResponse(channel, NOT_ACCEPTABLE, errorMessage)); }
static Request getUsers(GetUsersRequest getUsersRequest) { RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder() .addPathPartAsIs("_security/user"); if (getUsersRequest.getUsernames().size() > 0) { builder.addPathPart(Strings.collectionToCommaDelimitedString(getUsersRequest.getUsernames())); } return new Request(HttpGet.METHOD_NAME, builder.build()); }
static Request getRoles(GetRolesRequest getRolesRequest) { RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder(); builder.addPathPartAsIs("_xpack/security/role"); if (getRolesRequest.getRoleNames().size() > 0) { builder.addPathPart(Strings.collectionToCommaDelimitedString(getRolesRequest.getRoleNames())); } return new Request(HttpGet.METHOD_NAME, builder.build()); }
static Request getRoleMappings(final GetRoleMappingsRequest getRoleMappingRequest) throws IOException { RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder(); builder.addPathPartAsIs("_xpack/security/role_mapping"); if (getRoleMappingRequest.getRoleMappingNames().size() > 0) { builder.addPathPart(Strings.collectionToCommaDelimitedString(getRoleMappingRequest.getRoleMappingNames())); } return new Request(HttpGet.METHOD_NAME, builder.build()); }
static Request putCalendarJob(PutCalendarJobRequest putCalendarJobRequest) { String endpoint = new EndpointBuilder() .addPathPartAsIs("_xpack") .addPathPartAsIs("ml") .addPathPartAsIs("calendars") .addPathPart(putCalendarJobRequest.getCalendarId()) .addPathPartAsIs("jobs") .addPathPart(Strings.collectionToCommaDelimitedString(putCalendarJobRequest.getJobIds())) .build(); return new Request(HttpPut.METHOD_NAME, endpoint); }
static Request stopDatafeed(StopDatafeedRequest stopDatafeedRequest) throws IOException { String endpoint = new EndpointBuilder() .addPathPartAsIs("_xpack") .addPathPartAsIs("ml") .addPathPartAsIs("datafeeds") .addPathPart(Strings.collectionToCommaDelimitedString(stopDatafeedRequest.getDatafeedIds())) .addPathPartAsIs("_stop") .build(); Request request = new Request(HttpPost.METHOD_NAME, endpoint); request.setEntity(createEntity(stopDatafeedRequest, REQUEST_BODY_CONTENT_TYPE)); return request; }
static Request stopDatafeed(StopDatafeedRequest stopDatafeedRequest) throws IOException { String endpoint = new EndpointBuilder() .addPathPartAsIs("_xpack") .addPathPartAsIs("ml") .addPathPartAsIs("datafeeds") .addPathPart(Strings.collectionToCommaDelimitedString(stopDatafeedRequest.getDatafeedIds())) .addPathPartAsIs("_stop") .build(); Request request = new Request(HttpPost.METHOD_NAME, endpoint); request.setEntity(createEntity(stopDatafeedRequest, REQUEST_BODY_CONTENT_TYPE)); return request; }
static Request deleteCalendarJob(DeleteCalendarJobRequest deleteCalendarJobRequest) { String endpoint = new EndpointBuilder() .addPathPartAsIs("_xpack") .addPathPartAsIs("ml") .addPathPartAsIs("calendars") .addPathPart(deleteCalendarJobRequest.getCalendarId()) .addPathPartAsIs("jobs") .addPathPart(Strings.collectionToCommaDelimitedString(deleteCalendarJobRequest.getJobIds())) .build(); return new Request(HttpDelete.METHOD_NAME, endpoint); }
static Request closeJob(CloseJobRequest closeJobRequest) throws IOException { String endpoint = new EndpointBuilder() .addPathPartAsIs("_xpack") .addPathPartAsIs("ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(Strings.collectionToCommaDelimitedString(closeJobRequest.getJobIds())) .addPathPartAsIs("_close") .build(); Request request = new Request(HttpPost.METHOD_NAME, endpoint); request.setEntity(createEntity(closeJobRequest, REQUEST_BODY_CONTENT_TYPE)); return request; }
static Request getOverallBuckets(GetOverallBucketsRequest getOverallBucketsRequest) throws IOException { String endpoint = new EndpointBuilder() .addPathPartAsIs("_xpack") .addPathPartAsIs("ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(Strings.collectionToCommaDelimitedString(getOverallBucketsRequest.getJobIds())) .addPathPartAsIs("results") .addPathPartAsIs("overall_buckets") .build(); Request request = new Request(HttpGet.METHOD_NAME, endpoint); request.setEntity(createEntity(getOverallBucketsRequest, REQUEST_BODY_CONTENT_TYPE)); return request; }