Jian Li | b1cd0b0 | 2019-02-21 16:41:40 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019-present Open Networking Foundation |
| 3 | * |
| 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 | */ |
| 16 | package org.onosproject.k8snetworking.cli; |
| 17 | |
| 18 | import org.apache.karaf.shell.api.action.Command; |
| 19 | import org.apache.karaf.shell.api.action.lifecycle.Service; |
| 20 | import org.onosproject.cli.AbstractShellCommand; |
| 21 | import org.onosproject.k8snetworking.api.K8sEndpointsAdminService; |
Jian Li | 3d1111e | 2019-02-22 02:02:13 +0900 | [diff] [blame] | 22 | import org.onosproject.k8snetworking.api.K8sNetworkAdminService; |
Jian Li | b1cd0b0 | 2019-02-21 16:41:40 +0900 | [diff] [blame] | 23 | import org.onosproject.k8snetworking.api.K8sPodAdminService; |
| 24 | import org.onosproject.k8snetworking.api.K8sServiceAdminService; |
| 25 | |
| 26 | /** |
| 27 | * Purges all existing kubernetes states. |
| 28 | */ |
| 29 | @Service |
| 30 | @Command(scope = "onos", name = "k8s-purge-states", |
| 31 | description = "Purges all kubernetes states") |
Jian Li | 3d1111e | 2019-02-22 02:02:13 +0900 | [diff] [blame] | 32 | public class K8sPurgeStateCommand extends AbstractShellCommand { |
Jian Li | b1cd0b0 | 2019-02-21 16:41:40 +0900 | [diff] [blame] | 33 | @Override |
| 34 | protected void doExecute() { |
| 35 | get(K8sPodAdminService.class).clear(); |
Jian Li | 3d1111e | 2019-02-22 02:02:13 +0900 | [diff] [blame] | 36 | get(K8sNetworkAdminService.class).clear(); |
Jian Li | b1cd0b0 | 2019-02-21 16:41:40 +0900 | [diff] [blame] | 37 | get(K8sEndpointsAdminService.class).clear(); |
| 38 | get(K8sServiceAdminService.class).clear(); |
| 39 | } |
| 40 | } |