|
| 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 MachineLearning |
| 22 | + module Actions |
| 23 | + # Gets stats for anomaly detection job model snapshot upgrades that are in progress. |
| 24 | + # |
| 25 | + # @option arguments [String] :job_id The ID of the job. May be a wildcard, comma separated list or `_all`. |
| 26 | + # @option arguments [String] :snapshot_id The ID of the snapshot. May be a wildcard, comma separated list or `_all`. |
| 27 | + # @option arguments [Boolean] :allow_no_match Whether to ignore if a wildcard expression matches no jobs or no snapshots. (This includes the `_all` string.) |
| 28 | + # @option arguments [Hash] :headers Custom HTTP headers |
| 29 | + # |
| 30 | + # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.16/ml-get-job-model-snapshot-upgrade-stats.html |
| 31 | + # |
| 32 | + def get_model_snapshot_upgrade_stats(arguments = {}) |
| 33 | + raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id] |
| 34 | + raise ArgumentError, "Required argument 'snapshot_id' missing" unless arguments[:snapshot_id] |
| 35 | + |
| 36 | + headers = arguments.delete(:headers) || {} |
| 37 | + |
| 38 | + arguments = arguments.clone |
| 39 | + |
| 40 | + _job_id = arguments.delete(:job_id) |
| 41 | + |
| 42 | + _snapshot_id = arguments.delete(:snapshot_id) |
| 43 | + |
| 44 | + method = Elasticsearch::API::HTTP_GET |
| 45 | + path = "_ml/anomaly_detectors/#{Elasticsearch::API::Utils.__listify(_job_id)}/model_snapshots/#{Elasticsearch::API::Utils.__listify(_snapshot_id)}/_upgrade/_stats" |
| 46 | + params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) |
| 47 | + |
| 48 | + body = nil |
| 49 | + perform_request(method, path, params, body, headers).body |
| 50 | + end |
| 51 | + |
| 52 | + # Register this action with its valid params when the module is loaded. |
| 53 | + # |
| 54 | + # @since 6.2.0 |
| 55 | + ParamsRegistry.register(:get_model_snapshot_upgrade_stats, [ |
| 56 | + :allow_no_match |
| 57 | + ].freeze) |
| 58 | + end |
| 59 | + end |
| 60 | + end |
| 61 | + end |
| 62 | +end |
0 commit comments