Jian Li | daa7d6a | 2021-04-13 17:22:56 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2021-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.kubevirtnetworking.api; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | |
| 20 | import java.util.Set; |
| 21 | |
| 22 | /** |
| 23 | * Representation of load balancer. |
| 24 | */ |
| 25 | public interface KubevirtLoadBalancer { |
| 26 | |
| 27 | /** |
| 28 | * Returns the load balancer name. |
| 29 | * |
| 30 | * @return load balancer name |
| 31 | */ |
| 32 | String name(); |
| 33 | |
| 34 | /** |
| 35 | * Returns the load balancer description. |
| 36 | * |
| 37 | * @return load balancer description |
| 38 | */ |
| 39 | String description(); |
| 40 | |
| 41 | /** |
| 42 | * Returns the network identifier. |
| 43 | * |
| 44 | * @return network identifier |
| 45 | */ |
| 46 | String networkId(); |
| 47 | |
| 48 | /** |
| 49 | * Returns the load balancer virtual IP address. |
| 50 | * |
| 51 | * @return load balancer virtual IP address |
| 52 | */ |
| 53 | IpAddress vip(); |
| 54 | |
| 55 | /** |
| 56 | * Returns the IP address of members. |
| 57 | * |
| 58 | * @return IP addresses |
| 59 | */ |
| 60 | Set<IpAddress> members(); |
| 61 | |
| 62 | /** |
| 63 | * Returns the load balancer rules. |
| 64 | * |
| 65 | * @return load balancer rules |
| 66 | */ |
| 67 | Set<KubevirtLoadBalancerRule> rules(); |
| 68 | |
| 69 | /** |
| 70 | * A default builder interface. |
| 71 | */ |
| 72 | interface Builder { |
| 73 | /** |
| 74 | * Builds an immutable load balancer instance. |
| 75 | * |
| 76 | * @return kubevirt load balancer |
| 77 | */ |
| 78 | KubevirtLoadBalancer build(); |
| 79 | |
| 80 | /** |
| 81 | * Returns kubevirt load balancer builder with supplied load balancer name. |
| 82 | * |
| 83 | * @param name load balancer name |
| 84 | * @return load balancer builder |
| 85 | */ |
| 86 | Builder name(String name); |
| 87 | |
| 88 | /** |
| 89 | * Returns kubevirt load balancer builder with supplied load balancer description. |
| 90 | * |
| 91 | * @param description load balancer description |
| 92 | * @return load balancer builder |
| 93 | */ |
| 94 | Builder description(String description); |
| 95 | |
| 96 | /** |
| 97 | * Returns kubevirt load balancer builder with supplied load balancer network identifier. |
| 98 | * |
| 99 | * @param networkId load balancer network identifier |
| 100 | * @return load balancer builder |
| 101 | */ |
| 102 | Builder networkId(String networkId); |
| 103 | |
| 104 | /** |
| 105 | * Returns kubevirt load balancer builder with supplied load balancer vip. |
| 106 | * |
| 107 | * @param vip load balancer vip |
| 108 | * @return load balancer builder |
| 109 | */ |
| 110 | Builder vip(IpAddress vip); |
| 111 | |
| 112 | /** |
| 113 | * Returns kubevirt load balancer builder with supplied load balancer members. |
| 114 | * |
| 115 | * @param members load balancer members |
| 116 | * @return load balancer builder |
| 117 | */ |
| 118 | Builder members(Set<IpAddress> members); |
| 119 | |
| 120 | /** |
| 121 | * Returns kubevirt load balancer builder with supplied load balancer rules. |
| 122 | * |
| 123 | * @param rules load balancer rules |
| 124 | * @return load balancer builder |
| 125 | */ |
| 126 | Builder rules(Set<KubevirtLoadBalancerRule> rules); |
| 127 | } |
| 128 | } |