Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
feat(dbaas.logs): add kibana endpoints (#290)
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre De Paepe <[email protected]>
  • Loading branch information
pdepaepe authored Jun 1, 2020
1 parent ede9e34 commit 033025e
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/dbaas/logs/logs.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ angular.module('ovh-api-services').service('OvhApiDbaasLogs', ($injector) => ({
Dashboard() {
return $injector.get('OvhApiDbaasLogsDashboard');
},
Output() {
return $injector.get('OvhApiDbaasLogsOutput');
},
User() {
return $injector.get('OvhApiDbaasLogsUser');
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiDbaasLogsOutputElasticsearchKibana', ($injector) => ({
Kibana() {
return $injector.get('OvhApiDbaasLogsOutputElasticsearch');
},
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
angular.module('ovh-api-services').service('OvhApiDbaasLogsOutputElasticsearchKibanaAapi', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiDbaasLogsOutputElasticsearchKibanaAapi');

const kibana = $resource('/dbaas/logs/:serviceName/kibana/:kibanaId', {
serviceName: '@serviceName',
kibanaId: '@kibanaId',
}, {
get: {
method: 'GET',
serviceType: 'aapi',
cache,
isArray: false,
},
});

kibana.resetAllCache = function () {
kibana.resetCache();
};

kibana.resetCache = function () {
cache.removeAll();
};

return kibana;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module('ovh-api-services').service('OvhApiDbaasLogsOutputElasticsearchKibanaIceberg', (iceberg) => {
const kibanaResource = iceberg('/dbaas/logs/:serviceName/output/elasticsearch/kibana/:kibanaId', {
serviceName: '@serviceName',
kibanaId: '@kibanaId',
}, {
create: { method: 'POST' },
});

return kibanaResource;
});
11 changes: 11 additions & 0 deletions src/api/dbaas/logs/output/elasticsearch/kibana/kibana.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module('ovh-api-services').service('OvhApiDbaasLogsOutputElasticsearchKibana', ($injector) => ({
v6() {
return $injector.get('OvhApiDbaasLogsOutputElasticsearchKibanaV6');
},
Iceberg() {
return $injector.get('OvhApiDbaasLogsOutputElasticsearchKibanaIceberg');
},
Aapi() {
return $injector.get('OvhApiDbaasLogsOutputElasticsearchKibanaAapi');
},
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
angular.module('ovh-api-services').service('OvhApiDbaasLogsOutputElasticsearchKibanaV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiDbaasLogsOutputElasticsearchKibanaV6');
const queryCache = $cacheFactory('OvhApiDbaasLogsOutputElasticsearchKibanaV6Query');
const interceptor = {
response(response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response;
},
};

const kibanaResource = $resource('/dbaas/logs/:serviceName/output/elasticsearch/kibana/:kibanaId', {
serviceName: '@serviceName',
kibanaId: '@kibanaId',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
create: { method: 'POST', interceptor },
remove: { method: 'DELETE', interceptor },
});

kibanaResource.resetAllCache = function () {
kibanaResource.resetCache();
kibanaResource.resetQueryCache();
};

kibanaResource.resetCache = function () {
cache.removeAll();
};

kibanaResource.resetQueryCache = function () {
queryCache.removeAll();
};

return kibanaResource;
});
5 changes: 5 additions & 0 deletions src/api/dbaas/logs/output/output.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiDbaasLogsOutput', ($injector) => ({
Elasticsearch() {
return $injector.get('OvhApiDbaasLogsOutputElasticsearch');
},
}));

0 comments on commit 033025e

Please sign in to comment.