Skip to content

Commit a848d67

Browse files
committed
[XPACK] Update API for 6.7.0
1 parent 049e085 commit a848d67

File tree

4 files changed

+61
-2
lines changed

4 files changed

+61
-2
lines changed

elasticsearch-xpack/lib/elasticsearch/xpack.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ class Client
2929
def xpack
3030
@xpack_client ||= Elasticsearch::XPack::API::Client.new(self)
3131
end
32+
33+
def security
34+
@security ||= xpack.security
35+
end
36+
37+
def ml
38+
@ml ||= xpack.ml
39+
end
3240
end
3341
end
3442
end if defined?(Elasticsearch::Transport::Client)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
module Elasticsearch
19+
module XPack
20+
module API
21+
module Security
22+
module Actions
23+
24+
# Creates an API key for access without requiring basic authentication.
25+
#
26+
# @option arguments [String] :refresh If `true` (the default) then refresh the affected shards to make
27+
# this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to
28+
# search, if `false` then do nothing with refreshes.
29+
#
30+
# @option arguments [Hash] :body The api key request to create an API key. (*Required*)
31+
#
32+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
33+
#
34+
def create_api_key(arguments={})
35+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
36+
37+
valid_params = [ :refresh ]
38+
39+
method = Elasticsearch::API::HTTP_PUT
40+
path = "_security/api_key"
41+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
42+
43+
perform_request(method, path, params, arguments[:body]).body
44+
end
45+
end
46+
end
47+
end
48+
end
49+
end

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def put_watch(arguments={})
2020
valid_params = [
2121
:master_timeout,
2222
:active,
23-
:version ]
23+
:version,
24+
:if_seq_no,
25+
:if_primary_term ]
2426

2527
method = Elasticsearch::API::HTTP_PUT
2628
path = "_xpack/watcher/watch/#{arguments[:id]}"

elasticsearch-xpack/spec/support/test_file/action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def prepare_arguments(args, test)
8282
# Find the cached values where the variable name is contained in the arguments.
8383
if cached_value = test.cached_values.find { |k, v| value =~ /\$\{?#{k}\}?/ }
8484
# The arguments may contain the variable in the form ${variable} or $variable
85-
args[key] = value.gsub(/\$\{?#{cached_value[0]}\}?/, cached_value[1])
85+
args[key] = value.gsub(/\$\{?#{cached_value[0]}\}?/, cached_value[1].to_s)
8686
end
8787
end
8888
end

0 commit comments

Comments
 (0)