Skip to content

Commit 89a000d

Browse files
[API] Adds machine_learning.update_trained_model_deployment
Co-authored-by: Fernando Briano <[email protected]>
1 parent 4204769 commit 89a000d

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 MachineLearning
24+
module Actions
25+
# Updates certain properties of trained model deployment.
26+
# This functionality is in Beta and is subject to change. The design and
27+
# code is less mature than official GA features and is being provided
28+
# as-is with no warranties. Beta features are not subject to the support
29+
# SLA of official GA features.
30+
#
31+
# @option arguments [String] :model_id The unique identifier of the trained model.
32+
# @option arguments [Hash] :headers Custom HTTP headers
33+
# @option arguments [Hash] :body The updated trained model deployment settings (*Required*)
34+
#
35+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-trained-model-deployment.html
36+
#
37+
def update_trained_model_deployment(arguments = {})
38+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
39+
raise ArgumentError, "Required argument 'model_id' missing" unless arguments[:model_id]
40+
41+
arguments = arguments.clone
42+
headers = arguments.delete(:headers) || {}
43+
44+
body = arguments.delete(:body)
45+
46+
_model_id = arguments.delete(:model_id)
47+
48+
method = Elasticsearch::API::HTTP_POST
49+
path = "_ml/trained_models/#{Utils.__listify(_model_id)}/deployment/_update"
50+
params = {}
51+
52+
Elasticsearch::API::Response.new(
53+
perform_request(method, path, params, body, headers)
54+
)
55+
end
56+
end
57+
end
58+
end
59+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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#ml.update_trained_model_deployment' do
21+
let(:expected_args) do
22+
[
23+
'POST',
24+
'_ml/trained_models/foo/deployment/_update',
25+
{},
26+
{},
27+
{}
28+
]
29+
end
30+
31+
it 'performs the request' do
32+
expect(client_double.ml.update_trained_model_deployment(model_id: 'foo', body: {})).to be_a Elasticsearch::API::Response
33+
end
34+
end

0 commit comments

Comments
 (0)