blob: 1118dc5ccb7a8ccd437def1b341cad447767a243 [file] [log] [blame]
Jian Li85060ac2016-02-04 09:58:56 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Jian Li85060ac2016-02-04 09:58:56 -08003 *
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.cpman.cli;
17
18import com.google.common.collect.ImmutableList;
Ray Milkeya04e4442018-10-03 11:04:35 -070019import org.apache.karaf.shell.api.action.lifecycle.Service;
Jian Li85060ac2016-02-04 09:58:56 -080020import org.onosproject.cli.AbstractChoicesCompleter;
21
22import java.util.List;
23import java.util.stream.Collectors;
24
25import static org.onosproject.cpman.ControlResource.Type;
26
27/**
28 * Control resource type completer.
29 */
Ray Milkeya04e4442018-10-03 11:04:35 -070030@Service
Jian Li85060ac2016-02-04 09:58:56 -080031public class ControlResourceTypeCompleter extends AbstractChoicesCompleter {
32
33 private static final List<Type> RESOURCE_TYPES =
34 ImmutableList.of(Type.CPU, Type.MEMORY, Type.DISK, Type.NETWORK,
35 Type.CONTROL_MESSAGE);
36
37 @Override
38 protected List<String> choices() {
39 return RESOURCE_TYPES.stream().map(type ->
40 type.toString().toLowerCase()).collect(Collectors.toList());
41 }
42}