Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move non duplicated actions back into xpack core #32952

Merged
merged 1 commit into from
Aug 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions x-pack/plugin/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import java.nio.file.StandardCopyOption
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'nebula.maven-base-publish'
apply plugin: 'nebula.maven-scm'
apply plugin: 'com.github.johnrengelman.shadow'

archivesBaseName = 'x-pack-core'

Expand All @@ -27,7 +26,6 @@ dependencyLicenses {

dependencies {
compileOnly "org.elasticsearch:elasticsearch:${version}"
bundle project(':x-pack:protocol')
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
compile "org.apache.httpcomponents:httpcore-nio:${versions.httpcore}"
Expand Down Expand Up @@ -112,8 +110,7 @@ test {
// TODO: don't publish test artifacts just to run messy tests, fix the tests!
// https://github.com/elastic/x-plugins/issues/724
configurations {
testArtifacts.extendsFrom(testRuntime, shadow)
testArtifacts.exclude(group: project(':x-pack:protocol').group, module: project(':x-pack:protocol').name)
testArtifacts.extendsFrom testRuntime
}
task testJar(type: Jar) {
appendix 'test'
Expand All @@ -122,7 +119,7 @@ task testJar(type: Jar) {

artifacts {
// normal es plugins do not publish the jar but we need to since users need it for Transport Clients and extensions
archives shadowJar
archives jar
testArtifacts testJar
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.protocol.xpack;

import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;

import java.io.IOException;
import java.util.EnumSet;
import java.util.Locale;

/**
* Fetch information about X-Pack from the cluster.
*/
public class XPackInfoRequest extends ActionRequest {

public enum Category {
BUILD, LICENSE, FEATURES;

public static EnumSet<Category> toSet(String... categories) {
EnumSet<Category> set = EnumSet.noneOf(Category.class);
for (String category : categories) {
switch (category) {
case "_all":
return EnumSet.allOf(Category.class);
case "_none":
return EnumSet.noneOf(Category.class);
default:
set.add(Category.valueOf(category.toUpperCase(Locale.ROOT)));
}
}
return set;
}
}

private boolean verbose;
private EnumSet<Category> categories = EnumSet.noneOf(Category.class);

public XPackInfoRequest() {}

public void setVerbose(boolean verbose) {
this.verbose = verbose;
}

public boolean isVerbose() {
return verbose;
}

public void setCategories(EnumSet<Category> categories) {
this.categories = categories;
}

public EnumSet<Category> getCategories() {
return categories;
}

@Override
public ActionRequestValidationException validate() {
return null;
}

@Override
public void readFrom(StreamInput in) throws IOException {
this.verbose = in.readBoolean();
EnumSet<Category> categories = EnumSet.noneOf(Category.class);
int size = in.readVInt();
for (int i = 0; i < size; i++) {
categories.add(Category.valueOf(in.readString()));
}
this.categories = categories;
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(verbose);
out.writeVInt(categories.size());
for (Category category : categories) {
out.writeString(category.name());
}
}
}
Loading