diff --git a/plugin/pom.xml b/plugin/pom.xml index a2292e7230d..62be5a4d981 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -16,6 +16,8 @@ --> ${basedir}/src/test/resources ${project.parent.basedir} + license + false diff --git a/plugin/rest-api-spec/api/licenses.json b/plugin/rest-api-spec/api/licenses.json new file mode 100644 index 00000000000..1ab8197c227 --- /dev/null +++ b/plugin/rest-api-spec/api/licenses.json @@ -0,0 +1,19 @@ +{ + "licenses": { + "documentation": "https://www.elastic.co/guide/en/shield/current/license-management.html", + "methods": ["GET"], + "url": { + "path": "/_licenses", + "paths": ["/_licenses"], + "parts" : { + }, + "params": { + "local": { + "type" : "boolean", + "description" : "Return local information, do not retrieve the state from master node (default: false)" + } + } + }, + "body": null + } +} diff --git a/plugin/rest-api-spec/test/license/10_basic.yaml b/plugin/rest-api-spec/test/license/10_basic.yaml new file mode 100644 index 00000000000..30d9f3e3d49 --- /dev/null +++ b/plugin/rest-api-spec/test/license/10_basic.yaml @@ -0,0 +1,4 @@ +--- +"licenses endpoint exists": + - do: {licenses: {}} + - match: {licenses: []} diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/rest/LicensesRestIT.java b/plugin/src/test/java/org/elasticsearch/license/plugin/rest/LicensesRestIT.java new file mode 100644 index 00000000000..158aac9bf0a --- /dev/null +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/rest/LicensesRestIT.java @@ -0,0 +1,27 @@ +/* + * 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.license.plugin.rest; + + +import com.carrotsearch.randomizedtesting.annotations.Name; +import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; +import org.elasticsearch.test.rest.ElasticsearchRestTestCase; +import org.elasticsearch.test.rest.RestTestCandidate; +import org.elasticsearch.test.rest.parser.RestTestParseException; + +import java.io.IOException; + +public class LicensesRestIT extends ElasticsearchRestTestCase { + + public LicensesRestIT(@Name("yaml") RestTestCandidate testCandidate) { + super(testCandidate); + } + + @ParametersFactory + public static Iterable parameters() throws IOException, RestTestParseException { + return ElasticsearchRestTestCase.createParameters(0, 1); + } +}