Skip to content

Commit fc51e46

Browse files
committed
[API] Adds inference endpoints put_amazonsagemaker and put_deepseek
Updates cluster.put_component_template: * removes timeout * Adds [String] :cause User defined reason for create the component template
1 parent 9bf4cfd commit fc51e46

File tree

5 files changed

+211
-1
lines changed

5 files changed

+211
-1
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/cluster/put_component_template.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module Actions
2626
#
2727
# @option arguments [String] :name The name of the template
2828
# @option arguments [Boolean] :create Whether the index template should only be added if new or can also replace an existing one
29-
# @option arguments [Time] :timeout Explicit operation timeout
29+
# @option arguments [String] :cause User defined reason for create the component template
3030
# @option arguments [Time] :master_timeout Specify timeout for connection to master
3131
# @option arguments [Hash] :headers Custom HTTP headers
3232
# @option arguments [Hash] :body The template definition (*Required*)
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
20+
#
21+
module Elasticsearch
22+
module API
23+
module Inference
24+
module Actions
25+
# Configure a Amazon SageMaker inference endpoint
26+
#
27+
# @option arguments [String] :task_type The task type
28+
# @option arguments [String] :amazonsagemaker_inference_id The inference Id
29+
# @option arguments [Hash] :headers Custom HTTP headers
30+
# @option arguments [Hash] :body The inference endpoint's task and service settings
31+
#
32+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-amazon-sagemaker.html
33+
#
34+
def put_amazonsagemaker(arguments = {})
35+
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_amazonsagemaker' }
36+
37+
defined_params = %i[task_type amazonsagemaker_inference_id].each_with_object({}) do |variable, set_variables|
38+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
39+
end
40+
request_opts[:defined_params] = defined_params unless defined_params.empty?
41+
42+
raise ArgumentError, "Required argument 'task_type' missing" unless arguments[:task_type]
43+
44+
unless arguments[:amazonsagemaker_inference_id]
45+
raise ArgumentError,
46+
"Required argument 'amazonsagemaker_inference_id' missing"
47+
end
48+
49+
arguments = arguments.clone
50+
headers = arguments.delete(:headers) || {}
51+
52+
body = arguments.delete(:body)
53+
54+
_task_type = arguments.delete(:task_type)
55+
56+
_amazonsagemaker_inference_id = arguments.delete(:amazonsagemaker_inference_id)
57+
58+
method = Elasticsearch::API::HTTP_PUT
59+
path = "_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_amazonsagemaker_inference_id)}"
60+
params = {}
61+
62+
Elasticsearch::API::Response.new(
63+
perform_request(method, path, params, body, headers, request_opts)
64+
)
65+
end
66+
end
67+
end
68+
end
69+
end
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
20+
#
21+
module Elasticsearch
22+
module API
23+
module Inference
24+
module Actions
25+
# Configure a DeepSeek inference endpoint
26+
#
27+
# @option arguments [String] :task_type The task type
28+
# @option arguments [String] :deepseek_inference_id The inference Id
29+
# @option arguments [Hash] :headers Custom HTTP headers
30+
# @option arguments [Hash] :body The inference endpoint's task and service settings
31+
#
32+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/infer-service-deepseek.html
33+
#
34+
def put_deepseek(arguments = {})
35+
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_deepseek' }
36+
37+
defined_params = %i[task_type deepseek_inference_id].each_with_object({}) do |variable, set_variables|
38+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
39+
end
40+
request_opts[:defined_params] = defined_params unless defined_params.empty?
41+
42+
raise ArgumentError, "Required argument 'task_type' missing" unless arguments[:task_type]
43+
44+
unless arguments[:deepseek_inference_id]
45+
raise ArgumentError,
46+
"Required argument 'deepseek_inference_id' missing"
47+
end
48+
49+
arguments = arguments.clone
50+
headers = arguments.delete(:headers) || {}
51+
52+
body = arguments.delete(:body)
53+
54+
_task_type = arguments.delete(:task_type)
55+
56+
_deepseek_inference_id = arguments.delete(:deepseek_inference_id)
57+
58+
method = Elasticsearch::API::HTTP_PUT
59+
path = "_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_deepseek_inference_id)}"
60+
params = {}
61+
62+
Elasticsearch::API::Response.new(
63+
perform_request(method, path, params, body, headers, request_opts)
64+
)
65+
end
66+
end
67+
end
68+
end
69+
end
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
require 'spec_helper'
19+
20+
describe 'client#inference.put_amazonsagemaker' do
21+
let(:expected_args) do
22+
[
23+
'PUT',
24+
'_inference/foo/bar',
25+
{},
26+
nil,
27+
{},
28+
{ defined_params: { amazonsagemaker_inference_id: 'bar', task_type: 'foo' },
29+
endpoint: 'inference.put_amazonsagemaker' }
30+
]
31+
end
32+
33+
it 'performs the request' do
34+
expect(client_double.inference.put_amazonsagemaker(task_type: 'foo', amazonsagemaker_inference_id: 'bar')).to be_a Elasticsearch::API::Response
35+
end
36+
end
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
require 'spec_helper'
19+
20+
describe 'client#inference.put_deepseek' do
21+
let(:expected_args) do
22+
[
23+
'PUT',
24+
'_inference/foo/bar',
25+
{},
26+
nil,
27+
{},
28+
{ defined_params: { deepseek_inference_id: 'bar', task_type: 'foo' },
29+
endpoint: 'inference.put_deepseek' }
30+
]
31+
end
32+
33+
it 'performs the request' do
34+
expect(client_double.inference.put_deepseek(task_type: 'foo', deepseek_inference_id: 'bar')).to be_a Elasticsearch::API::Response
35+
end
36+
end

0 commit comments

Comments
 (0)