sangho | 6a9ff0d | 2017-03-27 11:23:37 +0900 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
sangho | 6a9ff0d | 2017-03-27 11:23:37 +0900 | [diff] [blame] | 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.openstacknetworking.api; |
| 17 | |
| 18 | import org.onosproject.event.AbstractEvent; |
| 19 | import org.openstack4j.model.network.SecurityGroup; |
| 20 | import org.openstack4j.model.network.SecurityGroupRule; |
| 21 | |
| 22 | /** |
| 23 | * Describes OpenStack security group event. |
| 24 | */ |
| 25 | public class OpenstackSecurityGroupEvent |
| 26 | extends AbstractEvent<OpenstackSecurityGroupEvent.Type, SecurityGroup> { |
| 27 | |
| 28 | private SecurityGroupRule sgRule; |
| 29 | |
| 30 | public enum Type { |
| 31 | /** |
| 32 | * Signifies that a new OpenStack security group is created. |
| 33 | */ |
| 34 | OPENSTACK_SECURITY_GROUP_CREATED, |
| 35 | |
| 36 | /** |
| 37 | * Signifies that the OpenStack security group is removed. |
| 38 | */ |
| 39 | OPENSTACK_SECURITY_GROUP_REMOVED, |
| 40 | |
| 41 | /** |
| 42 | * Signifies that a new OpenStack security group rule is created. |
| 43 | */ |
| 44 | OPENSTACK_SECURITY_GROUP_RULE_CREATED, |
| 45 | |
| 46 | /** |
| 47 | * Signifies that the OpenStack security group rule is removed. |
| 48 | */ |
| 49 | OPENSTACK_SECURITY_GROUP_RULE_REMOVED, |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * SecurityGroupEvent constructor. |
| 54 | * |
| 55 | * @param type SecurityGroupEvent type |
| 56 | * @param sg SecurityGroup object |
| 57 | */ |
Jian Li | 5ecfd1a | 2018-12-10 11:41:03 +0900 | [diff] [blame] | 58 | public OpenstackSecurityGroupEvent(OpenstackSecurityGroupEvent.Type type, |
| 59 | SecurityGroup sg) { |
sangho | 6a9ff0d | 2017-03-27 11:23:37 +0900 | [diff] [blame] | 60 | super(type, sg); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * SecurityGroupEvent constructor. |
| 65 | * |
| 66 | * @param type SecurityGroupEvent type |
Hyunsun Moon | ae51e73 | 2017-04-25 17:46:21 +0900 | [diff] [blame] | 67 | * @param sg security group |
sangho | 6a9ff0d | 2017-03-27 11:23:37 +0900 | [diff] [blame] | 68 | * @param sgRule SecurityGroup object |
| 69 | */ |
Jian Li | 5ecfd1a | 2018-12-10 11:41:03 +0900 | [diff] [blame] | 70 | public OpenstackSecurityGroupEvent(OpenstackSecurityGroupEvent.Type type, |
| 71 | SecurityGroup sg, |
Hyunsun Moon | ae51e73 | 2017-04-25 17:46:21 +0900 | [diff] [blame] | 72 | SecurityGroupRule sgRule) { |
| 73 | super(type, sg); |
sangho | 6a9ff0d | 2017-03-27 11:23:37 +0900 | [diff] [blame] | 74 | this.sgRule = sgRule; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns security group rule. |
| 79 | * |
| 80 | * @return SecurityGroupRule |
| 81 | */ |
| 82 | public SecurityGroupRule securityGroupRule() { |
| 83 | return this.sgRule; |
| 84 | } |
| 85 | } |