pierventre | 30368ab | 2021-02-24 23:23:22 +0100 | [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.segmentrouting.policy.api; |
| 17 | |
| 18 | import java.util.List; |
| 19 | |
| 20 | /** |
| 21 | * Policy data retrieved from the system. |
| 22 | */ |
| 23 | public final class PolicyData { |
| 24 | // We want to provide access to the policy data as well as |
| 25 | // the policy operations in the system and their status |
| 26 | private final PolicyState policyState; |
| 27 | private final Policy policy; |
| 28 | private final List<String> operations; |
| 29 | |
| 30 | /** |
| 31 | * Creates a policy data. |
| 32 | * |
| 33 | * @param pState the policy state |
| 34 | * @param pol the policy |
| 35 | * @param ops the operations associated |
| 36 | */ |
| 37 | public PolicyData(PolicyState pState, Policy pol, List<String> ops) { |
| 38 | policy = pol; |
| 39 | policyState = pState; |
| 40 | operations = ops; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Returns the current state of the policy. |
| 45 | * |
| 46 | * @return the policy state |
| 47 | */ |
| 48 | public PolicyState policyState() { |
| 49 | return policyState; |
| 50 | } |
| 51 | |
| 52 | |
| 53 | /** |
| 54 | * Returns the policy associated. |
| 55 | * |
| 56 | * @return the policy |
| 57 | */ |
| 58 | public Policy policy() { |
| 59 | return policy; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Returns the operations in the system in form of strings. |
| 64 | * |
| 65 | * @return the operations |
| 66 | */ |
| 67 | public List<String> operations() { |
| 68 | return operations; |
| 69 | } |
| 70 | } |