Skip to content

Commit

Permalink
Added Security namespace to Client
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed Sep 13, 2023
1 parent 34f37c4 commit 383c77a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const reindexRethrottleApi = require('./api/reindex_rethrottle');
const renderSearchTemplateApi = require('./api/render_search_template');
const scriptsPainlessExecuteApi = require('./api/scripts_painless_execute');
const scrollApi = require('./api/scroll');
const securityApi = require('./api/security');
const SecurityApi = require('./api/security');
const searchApi = require('./api/search');
const searchShardsApi = require('./api/search_shards');
const searchTemplateApi = require('./api/search_template');
Expand All @@ -92,6 +92,7 @@ const kFeatures = Symbol('Features');
const kIndices = Symbol('Indices');
const kIngest = Symbol('Ingest');
const kNodes = Symbol('Nodes');
const kSecurity = Symbol('Security');
const kShutdown = Symbol('Shutdown');
const kSnapshot = Symbol('Snapshot');
const kTasks = Symbol('Tasks');
Expand All @@ -105,6 +106,7 @@ function OpenSearchAPI(opts) {
this[kIndices] = null;
this[kIngest] = null;
this[kNodes] = null;
this[kSecurity] = null;
this[kShutdown] = null;
this[kSnapshot] = null;
this[kTasks] = null;
Expand Down Expand Up @@ -145,7 +147,6 @@ OpenSearchAPI.prototype.reindexRethrottle = reindexRethrottleApi;
OpenSearchAPI.prototype.renderSearchTemplate = renderSearchTemplateApi;
OpenSearchAPI.prototype.scriptsPainlessExecute = scriptsPainlessExecuteApi;
OpenSearchAPI.prototype.scroll = scrollApi;
OpenSearchAPI.prototype.security = securityApi;
OpenSearchAPI.prototype.search = searchApi;
OpenSearchAPI.prototype.searchShards = searchShardsApi;
OpenSearchAPI.prototype.searchTemplate = searchTemplateApi;
Expand Down Expand Up @@ -327,6 +328,14 @@ Object.defineProperties(OpenSearchAPI.prototype, {
return this.searchTemplate;
},
},
security: {
get() {
if (this[kSecurity] === null) {
this[kSecurity] = new SecurityApi(this.transport, this[kConfigurationError]);
}
return this[kSecurity];
},
},
shutdown: {
get() {
if (this[kShutdown] === null) {
Expand Down

0 comments on commit 383c77a

Please sign in to comment.