@elastic/elasticsearch-canary
Advanced tools
Comparing version 7.13.0-canary.4 to 7.14.0-canary.1
@@ -59,3 +59,3 @@ /* | ||
path, | ||
body: body || '', | ||
bulkBody: body, | ||
querystring | ||
@@ -62,0 +62,0 @@ } |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'master_timeout', 'wait_for_completion', 'storage', 'level'] | ||
const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' } | ||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'master_timeout', 'wait_for_completion', 'storage', 'level'] | ||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' } | ||
@@ -35,2 +35,28 @@ function SearchableSnapshotsApi (transport, ConfigurationError) { | ||
SearchableSnapshotsApi.prototype.cacheStats = function searchableSnapshotsCacheStatsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, nodeId, node_id, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((node_id || nodeId) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_searchable_snapshots' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'cache' + '/' + 'stats' | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'stats' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SearchableSnapshotsApi.prototype.clearCache = function searchableSnapshotsClearCacheApi (params, options, callback) { | ||
@@ -157,2 +183,3 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
Object.defineProperties(SearchableSnapshotsApi.prototype, { | ||
cache_stats: { get () { return this.cacheStats } }, | ||
clear_cache: { get () { return this.clearCache } }, | ||
@@ -159,0 +186,0 @@ repository_stats: { get () { return this.repositoryStats } } |
@@ -195,2 +195,46 @@ /* | ||
SecurityApi.prototype.clearCachedServiceTokens = function securityClearCachedServiceTokensApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.name != null && (params.service == null || params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace') | ||
return handleError(err, callback) | ||
} else if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name) + '/' + '_clear_cache' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.createApiKey = function securityCreateApiKeyApi (params, options, callback) { | ||
@@ -223,2 +267,47 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
SecurityApi.prototype.createServiceToken = function securityCreateServiceTokenApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.name != null && (params.service == null || params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace') | ||
return handleError(err, callback) | ||
} else if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((namespace) != null && (service) != null && (name) != null) { | ||
if (method == null) method = 'PUT' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name) | ||
} else { | ||
if (method == null) method = 'POST' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.deletePrivileges = function securityDeletePrivilegesApi (params, options, callback) { | ||
@@ -315,2 +404,46 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
SecurityApi.prototype.deleteServiceToken = function securityDeleteServiceTokenApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.name != null && (params.service == null || params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace') | ||
return handleError(err, callback) | ||
} else if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'DELETE' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.deleteUser = function securityDeleteUserApi (params, options, callback) { | ||
@@ -526,2 +659,74 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
SecurityApi.prototype.getServiceAccounts = function securityGetServiceAccountsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required url components | ||
if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((namespace) != null && (service) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) | ||
} else if ((namespace) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.getServiceCredentials = function securityGetServiceCredentialsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.getToken = function securityGetTokenApi (params, options, callback) { | ||
@@ -840,6 +1045,9 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
clear_cached_roles: { get () { return this.clearCachedRoles } }, | ||
clear_cached_service_tokens: { get () { return this.clearCachedServiceTokens } }, | ||
create_api_key: { get () { return this.createApiKey } }, | ||
create_service_token: { get () { return this.createServiceToken } }, | ||
delete_privileges: { get () { return this.deletePrivileges } }, | ||
delete_role: { get () { return this.deleteRole } }, | ||
delete_role_mapping: { get () { return this.deleteRoleMapping } }, | ||
delete_service_token: { get () { return this.deleteServiceToken } }, | ||
delete_user: { get () { return this.deleteUser } }, | ||
@@ -853,2 +1061,4 @@ disable_user: { get () { return this.disableUser } }, | ||
get_role_mapping: { get () { return this.getRoleMapping } }, | ||
get_service_accounts: { get () { return this.getServiceAccounts } }, | ||
get_service_credentials: { get () { return this.getServiceCredentials } }, | ||
get_token: { get () { return this.getToken } }, | ||
@@ -855,0 +1065,0 @@ get_user: { get () { return this.getUser } }, |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'verbose', 'local'] | ||
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable' } | ||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'verbose', 'local'] | ||
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details' } | ||
@@ -30,0 +30,0 @@ function SnapshotApi (transport, ConfigurationError) { |
@@ -44,2 +44,3 @@ /* | ||
const fieldCapsApi = require('./api/field_caps') | ||
const FleetApi = require('./api/fleet') | ||
const getApi = require('./api/get') | ||
@@ -106,2 +107,3 @@ const getScriptApi = require('./api/get_script') | ||
const kFeatures = Symbol('Features') | ||
const kFleet = Symbol('Fleet') | ||
const kGraph = Symbol('Graph') | ||
@@ -142,2 +144,3 @@ const kIlm = Symbol('Ilm') | ||
this[kFeatures] = null | ||
this[kFleet] = null | ||
this[kGraph] = null | ||
@@ -291,2 +294,10 @@ this[kIlm] = null | ||
field_caps: { get () { return this.fieldCaps } }, | ||
fleet: { | ||
get () { | ||
if (this[kFleet] === null) { | ||
this[kFleet] = new FleetApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kFleet] | ||
} | ||
}, | ||
get_script: { get () { return this.getScript } }, | ||
@@ -293,0 +304,0 @@ get_script_context: { get () { return this.getScriptContext } }, |
@@ -93,3 +93,11 @@ /* | ||
this.name = 'ResponseError' | ||
this.message = (meta.body && meta.body.error && meta.body.error.type) || 'Response Error' | ||
if (meta.body && meta.body.error && meta.body.status) { | ||
if (Array.isArray(meta.body.error.root_cause)) { | ||
this.message = meta.body.error.root_cause.map(entry => `[${entry.type}] Reason: ${entry.reason}`).join('; ') | ||
} else { | ||
this.message = 'Response Error' | ||
} | ||
} else { | ||
this.message = 'Response Error' | ||
} | ||
this.meta = meta | ||
@@ -112,2 +120,6 @@ } | ||
} | ||
toString () { | ||
return JSON.stringify(this.meta.body) | ||
} | ||
} | ||
@@ -114,0 +126,0 @@ |
@@ -309,4 +309,4 @@ /* | ||
} else { | ||
// cast to boolean if the request method was HEAD | ||
result.body = isHead === true ? true : payload | ||
// cast to boolean if the request method was HEAD and there was no error | ||
result.body = isHead === true && result.statusCode < 400 ? true : payload | ||
} | ||
@@ -313,0 +313,0 @@ |
@@ -14,4 +14,4 @@ { | ||
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html", | ||
"version": "7.13.0-canary.4", | ||
"versionCanary": "7.13.0-canary.4", | ||
"version": "7.14.0-canary.1", | ||
"versionCanary": "7.14.0-canary.1", | ||
"keywords": [ | ||
@@ -108,3 +108,3 @@ "elasticsearch", | ||
}, | ||
"commitHash": "d3d940d1" | ||
"commitHash": "4441de67" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1831826
103
33900