mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
adhear to new API naming conventions
This commit is contained in:
parent
549d0e4f77
commit
7bf6264c09
6 changed files with 57 additions and 57 deletions
|
@ -31,7 +31,7 @@ export default function (server) {
|
|||
};
|
||||
|
||||
server.route({
|
||||
path: '/api/index-patterns',
|
||||
path: '/api/kibana/index_patterns',
|
||||
method: 'GET',
|
||||
handler: function (req, reply) {
|
||||
let client = server.plugins.elasticsearch.client;
|
||||
|
@ -68,7 +68,7 @@ export default function (server) {
|
|||
});
|
||||
|
||||
server.route({
|
||||
path: '/api/index-patterns/{id}',
|
||||
path: '/api/kibana/index_patterns/{id}',
|
||||
method: 'GET',
|
||||
handler: function (req, reply) {
|
||||
let client = server.plugins.elasticsearch.client;
|
||||
|
@ -95,7 +95,7 @@ export default function (server) {
|
|||
});
|
||||
|
||||
server.route({
|
||||
path: '/api/index-patterns',
|
||||
path: '/api/kibana/index_patterns',
|
||||
method: 'POST',
|
||||
handler: function (req, reply) {
|
||||
if (_.isEmpty(req.payload)) { return reply(Boom.badRequest('Payload required')); }
|
||||
|
@ -170,7 +170,7 @@ export default function (server) {
|
|||
});
|
||||
|
||||
server.route({
|
||||
path: '/api/index-patterns/{id}',
|
||||
path: '/api/kibana/index_patterns/{id}',
|
||||
method: 'PUT',
|
||||
handler: function (req, reply) {
|
||||
if (_.isEmpty(req.payload)) { return reply(Boom.badRequest('Payload required')); }
|
||||
|
@ -212,7 +212,7 @@ export default function (server) {
|
|||
});
|
||||
|
||||
server.route({
|
||||
path: '/api/index-patterns/{id}',
|
||||
path: '/api/kibana/index_patterns/{id}',
|
||||
method: 'DELETE',
|
||||
handler: function (req, reply) {
|
||||
let client = server.plugins.elasticsearch.client;
|
||||
|
|
|
@ -7,23 +7,23 @@ define(function (require) {
|
|||
|
||||
return function (bdd, scenarioManager, request) {
|
||||
|
||||
bdd.describe('DELETE index-patterns', function deleteIndexPatterns() {
|
||||
bdd.describe('DELETE index_patterns', function deleteIndexPatterns() {
|
||||
|
||||
bdd.beforeEach(function () {
|
||||
return scenarioManager.reload('emptyKibana').then(function () {
|
||||
return request.post('/index-patterns').send(createTestData().indexPatternWithMappings);
|
||||
return request.post('/kibana/index_patterns').send(createTestData().indexPatternWithMappings);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.afterEach(function () {
|
||||
return request.del('/index-patterns/logstash-*');
|
||||
return request.del('/kibana/index_patterns/logstash-*');
|
||||
});
|
||||
|
||||
bdd.it('should return 200 for successful deletion of pattern and template', function () {
|
||||
return request.del('/index-patterns/logstash-*')
|
||||
return request.del('/kibana/index_patterns/logstash-*')
|
||||
.expect(200)
|
||||
.then(function () {
|
||||
return request.get('/index-patterns/logstash-*').expect(404);
|
||||
return request.get('/kibana/index_patterns/logstash-*').expect(404);
|
||||
})
|
||||
.then(function () {
|
||||
return scenarioManager.client.indices.getTemplate({name: 'kibana-logstash-*'})
|
||||
|
@ -34,7 +34,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
bdd.it('should return 404 for a non-existent id', function () {
|
||||
return request.del('/index-patterns/doesnotexist')
|
||||
return request.del('/kibana/index_patterns/doesnotexist')
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
|
|
|
@ -8,15 +8,15 @@ define(function (require) {
|
|||
|
||||
return function (bdd, scenarioManager, request) {
|
||||
|
||||
bdd.describe('GET index-patterns', function getIndexPatterns() {
|
||||
bdd.describe('GET index_patterns', function getIndexPatterns() {
|
||||
|
||||
bdd.before(function () {
|
||||
return scenarioManager.reload('emptyKibana').then(function () {
|
||||
return Promise.all([
|
||||
request.post('/index-patterns').send(createTestData().indexPatternWithMappings),
|
||||
request.post('/index-patterns').send(_.assign(createTestData().indexPatternWithMappings, {title: 'foo'})),
|
||||
request.post('/index-patterns').send(_.assign(createTestData().indexPatternWithMappings, {title: 'bar*'})),
|
||||
request.post('/index-patterns').send(_.assign(createTestData().indexPatternWithMappings,
|
||||
request.post('/kibana/index_patterns').send(createTestData().indexPatternWithMappings),
|
||||
request.post('/kibana/index_patterns').send(_.assign(createTestData().indexPatternWithMappings, {title: 'foo'})),
|
||||
request.post('/kibana/index_patterns').send(_.assign(createTestData().indexPatternWithMappings, {title: 'bar*'})),
|
||||
request.post('/kibana/index_patterns').send(_.assign(createTestData().indexPatternWithMappings,
|
||||
{title: '[.marvel-es-]YYYY.MM.DD'}))
|
||||
]).then(function () {
|
||||
return scenarioManager.client.indices.refresh({
|
||||
|
@ -28,15 +28,15 @@ define(function (require) {
|
|||
|
||||
bdd.after(function () {
|
||||
return Promise.all([
|
||||
request.del('/index-patterns/logstash-*'),
|
||||
request.del('/index-patterns/foo'),
|
||||
request.del('/index-patterns/bar*'),
|
||||
request.del('/index-patterns/[.marvel-es-]YYYY.MM.DD')
|
||||
request.del('/kibana/index_patterns/logstash-*'),
|
||||
request.del('/kibana/index_patterns/foo'),
|
||||
request.del('/kibana/index_patterns/bar*'),
|
||||
request.del('/kibana/index_patterns/[.marvel-es-]YYYY.MM.DD')
|
||||
]);
|
||||
});
|
||||
|
||||
bdd.it('should return 200 with all patterns in an array', function return200() {
|
||||
return request.get('/index-patterns')
|
||||
return request.get('/kibana/index_patterns')
|
||||
.expect(200)
|
||||
.then(function (res) {
|
||||
expect(res.body).to.be.an('array');
|
||||
|
@ -44,10 +44,10 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
bdd.describe('GET index-pattern by ID', function getIndexPatternByID() {
|
||||
bdd.describe('GET index_pattern by ID', function getIndexPatternByID() {
|
||||
|
||||
bdd.it('should return 200 with the valid index pattern requested', function () {
|
||||
return request.get('/index-patterns/logstash-*')
|
||||
return request.get('/kibana/index_patterns/logstash-*')
|
||||
.expect(200)
|
||||
.then(function (res) {
|
||||
expect(res.body.title).to.be('logstash-*');
|
||||
|
@ -61,15 +61,15 @@ define(function (require) {
|
|||
return _.omit(field, 'mapping');
|
||||
});
|
||||
|
||||
return request.del('/index-patterns/logstash-*').expect(200)
|
||||
return request.del('/kibana/index_patterns/logstash-*').expect(200)
|
||||
.then(function () {
|
||||
return scenarioManager.load('makelogs');
|
||||
})
|
||||
.then(function () {
|
||||
return request.post('/index-patterns').send(pattern).expect(201);
|
||||
return request.post('/kibana/index_patterns').send(pattern).expect(201);
|
||||
})
|
||||
.then(function () {
|
||||
return request.get('/index-patterns/logstash-*').expect(200);
|
||||
return request.get('/kibana/index_patterns/logstash-*').expect(200);
|
||||
})
|
||||
.then(function (res) {
|
||||
expect(res.body.fields[0].mapping).to.be.an('object');
|
||||
|
@ -80,7 +80,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
bdd.it('should return 404 for a non-existent ID', function () {
|
||||
return request.get('/index-patterns/thisdoesnotexist').expect(404);
|
||||
return request.get('/kibana/index_patterns/thisdoesnotexist').expect(404);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -5,39 +5,39 @@ define(function (require) {
|
|||
var expect = require('intern/dojo/node!expect.js');
|
||||
|
||||
return function (bdd, scenarioManager, request) {
|
||||
bdd.describe('POST index-patterns', function postIndexPatterns() {
|
||||
bdd.describe('POST index_patterns', function postIndexPatterns() {
|
||||
|
||||
bdd.beforeEach(function () {
|
||||
return scenarioManager.reload('emptyKibana');
|
||||
});
|
||||
|
||||
bdd.afterEach(function () {
|
||||
return request.del('/index-patterns/logstash-*');
|
||||
return request.del('/kibana/index_patterns/logstash-*');
|
||||
});
|
||||
|
||||
bdd.it('should return 400 for an invalid payload', function invalidPayload() {
|
||||
return Promise.all([
|
||||
request.post('/index-patterns').expect(400),
|
||||
request.post('/kibana/index_patterns').expect(400),
|
||||
|
||||
request.post('/index-patterns')
|
||||
request.post('/kibana/index_patterns')
|
||||
.send({})
|
||||
.expect(400),
|
||||
|
||||
request.post('/index-patterns')
|
||||
request.post('/kibana/index_patterns')
|
||||
.send(_.assign(createTestData().indexPatternWithMappings, {title: false}))
|
||||
.expect(400),
|
||||
|
||||
request.post('/index-patterns')
|
||||
request.post('/kibana/index_patterns')
|
||||
.send(_.assign(createTestData().indexPatternWithMappings, {fields: {}}))
|
||||
.expect(400),
|
||||
|
||||
// Fields must have a name
|
||||
request.post('/index-patterns')
|
||||
request.post('/kibana/index_patterns')
|
||||
.send(_.assign(createTestData().indexPatternWithMappings, {fields: [{count: 0}]}))
|
||||
.expect(400),
|
||||
|
||||
// Mapping requires type
|
||||
request.post('/index-patterns')
|
||||
request.post('/kibana/index_patterns')
|
||||
.send(_.assign(createTestData().indexPatternWithMappings, {
|
||||
fields: [{
|
||||
'name': 'geo.coordinates',
|
||||
|
@ -51,13 +51,13 @@ define(function (require) {
|
|||
});
|
||||
|
||||
bdd.it('should return 201 when a pattern is successfully created', function createPattern() {
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(createTestData().indexPatternWithMappings)
|
||||
.expect(201);
|
||||
});
|
||||
|
||||
bdd.it('should create an index template if mappings are provided', function createTemplate() {
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(createTestData().indexPatternWithMappings)
|
||||
.expect(201)
|
||||
.then(function () {
|
||||
|
@ -71,7 +71,7 @@ define(function (require) {
|
|||
return _.omit(field, 'mapping');
|
||||
});
|
||||
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(pattern)
|
||||
.expect(201)
|
||||
.then(function () {
|
||||
|
@ -88,7 +88,7 @@ define(function (require) {
|
|||
var pattern = createTestData().indexPatternWithMappings;
|
||||
pattern.title = 'notawildcard';
|
||||
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(pattern)
|
||||
.expect(201)
|
||||
.then(function () {
|
||||
|
@ -102,11 +102,11 @@ define(function (require) {
|
|||
});
|
||||
|
||||
bdd.it('should return 409 conflict when a pattern with the given ID already exists', function patternConflict() {
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(createTestData().indexPatternWithMappings)
|
||||
.expect(201)
|
||||
.then(function () {
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(createTestData().indexPatternWithMappings)
|
||||
.expect(409);
|
||||
});
|
||||
|
@ -119,7 +119,7 @@ define(function (require) {
|
|||
template: 'logstash-*'
|
||||
}
|
||||
}).then(function () {
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(createTestData().indexPatternWithMappings)
|
||||
.expect(409);
|
||||
});
|
||||
|
@ -130,7 +130,7 @@ define(function (require) {
|
|||
var pattern = createTestData().indexPatternWithMappings;
|
||||
pattern.title = '.kib*';
|
||||
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(pattern)
|
||||
.expect(409);
|
||||
});
|
||||
|
@ -143,7 +143,7 @@ define(function (require) {
|
|||
});
|
||||
pattern.title = '.kib*';
|
||||
|
||||
return request.post('/index-patterns')
|
||||
return request.post('/kibana/index_patterns')
|
||||
.send(pattern)
|
||||
.expect(201);
|
||||
});
|
||||
|
|
|
@ -6,16 +6,16 @@ define(function (require) {
|
|||
|
||||
return function (bdd, scenarioManager, request) {
|
||||
|
||||
bdd.describe('PUT index-patterns', function putIndexPatterns() {
|
||||
bdd.describe('PUT index_patterns', function putIndexPatterns() {
|
||||
|
||||
bdd.beforeEach(function () {
|
||||
return scenarioManager.reload('emptyKibana').then(function () {
|
||||
return request.post('/index-patterns').send(createTestData().indexPatternWithMappings);
|
||||
return request.post('/kibana/index_patterns').send(createTestData().indexPatternWithMappings);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.afterEach(function () {
|
||||
return request.del('/index-patterns/logstash-*');
|
||||
return request.del('/kibana/index_patterns/logstash-*');
|
||||
});
|
||||
|
||||
bdd.it('should return 200 for a successful update', function () {
|
||||
|
@ -26,11 +26,11 @@ define(function (require) {
|
|||
pattern.timeFieldName = 'foo';
|
||||
pattern.fields[0].count = 5;
|
||||
|
||||
return request.put('/index-patterns/logstash-*')
|
||||
return request.put('/kibana/index_patterns/logstash-*')
|
||||
.send(pattern)
|
||||
.expect(200)
|
||||
.then(function () {
|
||||
return request.get('/index-patterns/logstash-*');
|
||||
return request.get('/kibana/index_patterns/logstash-*');
|
||||
})
|
||||
.then(function (res) {
|
||||
expect(res.body.timeFieldName).to.be('foo');
|
||||
|
@ -45,13 +45,13 @@ define(function (require) {
|
|||
});
|
||||
pattern.title = 'foo';
|
||||
|
||||
return request.put('/index-patterns/logstash-*')
|
||||
return request.put('/kibana/index_patterns/logstash-*')
|
||||
.send(pattern)
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
bdd.it('should return 400 if you try to update mappings', function () {
|
||||
return request.put('/index-patterns/logstash-*')
|
||||
return request.put('/kibana/index_patterns/logstash-*')
|
||||
.send(createTestData().indexPatternWithMappings)
|
||||
.expect(400);
|
||||
});
|
||||
|
@ -65,19 +65,19 @@ define(function (require) {
|
|||
};
|
||||
|
||||
return Promise.all([
|
||||
request.put('/index-patterns/logstash-*').expect(400),
|
||||
request.put('/kibana/index_patterns/logstash-*').expect(400),
|
||||
|
||||
request.put('/index-patterns/logstash-*')
|
||||
request.put('/kibana/index_patterns/logstash-*')
|
||||
.send({})
|
||||
.expect(400),
|
||||
|
||||
//fields must be an array
|
||||
request.put('/index-patterns/logstash-*')
|
||||
request.put('/kibana/index_patterns/logstash-*')
|
||||
.send(_.assign(omitMappings(createTestData().indexPatternWithMappings), {fields: {}}))
|
||||
.expect(400),
|
||||
|
||||
// field objects must have a name
|
||||
request.put('/index-patterns/logstash-*')
|
||||
request.put('/kibana/index_patterns/logstash-*')
|
||||
.send(_.assign(omitMappings(createTestData().indexPatternWithMappings), {fields: [{count: 0}]}))
|
||||
.expect(400)
|
||||
]);
|
||||
|
@ -90,7 +90,7 @@ define(function (require) {
|
|||
});
|
||||
pattern.title = 'idonotexist';
|
||||
|
||||
return request.put('/index-patterns/idonotexist')
|
||||
return request.put('/kibana/index_patterns/idonotexist')
|
||||
.send(pattern)
|
||||
.expect(404);
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ define(function (require) {
|
|||
var put = require('./_put');
|
||||
var del = require('./_del');
|
||||
|
||||
bdd.describe('index-patterns API', function () {
|
||||
bdd.describe('index_patterns API', function () {
|
||||
var scenarioManager = new ScenarioManager(url.format(config.servers.elasticsearch));
|
||||
request = request(url.format(config.servers.kibana) + '/api');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue