Jian Li | 3defa84 | 2019-02-12 00:31:35 +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.k8snode.api; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onosproject.k8snode.api.K8sApiConfig.Scheme; |
| 20 | import org.onosproject.store.Store; |
| 21 | |
| 22 | import java.util.Set; |
| 23 | |
| 24 | /** |
| 25 | * Manages inventory of kubernetes API config; not intended for direct use. |
| 26 | */ |
| 27 | public interface K8sApiConfigStore |
| 28 | extends Store<K8sApiConfigEvent, K8sApiConfigStoreDelegate> { |
| 29 | |
| 30 | /** |
| 31 | * Creates a API config. |
| 32 | * |
| 33 | * @param config kubernetes API server config |
| 34 | */ |
| 35 | void createApiConfig(K8sApiConfig config); |
| 36 | |
| 37 | /** |
| 38 | * Updates the API config. |
| 39 | * |
| 40 | * @param config kubernetes API server config |
| 41 | */ |
| 42 | void updateApiConfig(K8sApiConfig config); |
| 43 | |
| 44 | /** |
| 45 | * Removes the kubernetes API config with the given endpoint. |
| 46 | * Endpoint comprises of scheme (HTTP), IP address and port |
| 47 | * |
| 48 | * @param endpoint kubernetes API endpoint |
| 49 | * @return removed kubernetes API server config; null if no config |
| 50 | * associated with the endpoint |
| 51 | */ |
| 52 | K8sApiConfig removeApiConfig(String endpoint); |
| 53 | |
| 54 | /** |
| 55 | * Removes the kubernetes API config with the given scheme, IP and port. |
| 56 | * |
| 57 | * @param scheme scheme (HTTP/HTTPS) |
| 58 | * @param ipAddress IP address of API server |
| 59 | * @param port port number of API server |
| 60 | * @return removed kubernetes API server config; null if no config |
| 61 | * associated with the scheme, IP and port |
| 62 | */ |
| 63 | K8sApiConfig removeApiConfig(Scheme scheme, IpAddress ipAddress, int port); |
| 64 | |
| 65 | /** |
| 66 | * Returns all registered kubernetes API configs. |
| 67 | * |
| 68 | * @return set of kubernetes API configs |
| 69 | */ |
| 70 | Set<K8sApiConfig> apiConfigs(); |
| 71 | |
| 72 | /** |
| 73 | * Returns the API config with the specified endpoint. |
| 74 | * |
| 75 | * @param endpoint endpoint |
| 76 | * @return kubernetes API config |
| 77 | */ |
| 78 | K8sApiConfig apiConfig(String endpoint); |
| 79 | |
| 80 | /** |
| 81 | * Returns the API config with the specified scheme, IP and port. |
| 82 | * |
| 83 | * @param scheme scheme (HTTP/HTTPS) |
| 84 | * @param ipAddress IP address of API server |
| 85 | * @param port port number of API server |
| 86 | * @return kubernetes API config |
| 87 | */ |
| 88 | K8sApiConfig apiConfig(Scheme scheme, IpAddress ipAddress, int port); |
| 89 | } |