blob: 62734f59e62eb364da8171654451402311e62f75 [file] [log] [blame]
Flavio Castro4b519412015-07-24 12:57:59 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Flavio Castro4b519412015-07-24 12:57:59 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.cli;
17
Ray Milkey0068fd02018-10-11 15:45:39 -070018import org.apache.karaf.shell.api.action.lifecycle.Service;
Flavio Castro4b519412015-07-24 12:57:59 -070019import org.onlab.metrics.MetricsService;
20
21import java.util.ArrayList;
22import java.util.List;
23
24/**
25 * Metric name completer.
26 */
Ray Milkey0068fd02018-10-11 15:45:39 -070027@Service
Flavio Castro4b519412015-07-24 12:57:59 -070028public class MetricNameCompleter extends AbstractChoicesCompleter {
29
30 @Override
31 protected List<String> choices() {
32 MetricsService metricsService = AbstractShellCommand.get(MetricsService.class);
Sho SHIMIZUa8dbad42015-09-11 14:22:25 -070033 return new ArrayList<>(metricsService.getMetrics().keySet());
Flavio Castro4b519412015-07-24 12:57:59 -070034 }
35
36}