blob: a2c8f4887c667dc804d014c260d4f2eefc44208a [file] [log] [blame]
sangho6a9ff0d2017-03-27 11:23:37 +09001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
sangho6a9ff0d2017-03-27 11:23:37 +09003 *
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 */
16package org.onosproject.openstacknetworking.api;
17
18import org.onosproject.event.AbstractEvent;
19import org.openstack4j.model.network.SecurityGroup;
20import org.openstack4j.model.network.SecurityGroupRule;
21
22/**
23 * Describes OpenStack security group event.
24 */
25public 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 Li5ecfd1a2018-12-10 11:41:03 +090058 public OpenstackSecurityGroupEvent(OpenstackSecurityGroupEvent.Type type,
59 SecurityGroup sg) {
sangho6a9ff0d2017-03-27 11:23:37 +090060 super(type, sg);
61 }
62
63 /**
64 * SecurityGroupEvent constructor.
65 *
66 * @param type SecurityGroupEvent type
Hyunsun Moonae51e732017-04-25 17:46:21 +090067 * @param sg security group
sangho6a9ff0d2017-03-27 11:23:37 +090068 * @param sgRule SecurityGroup object
69 */
Jian Li5ecfd1a2018-12-10 11:41:03 +090070 public OpenstackSecurityGroupEvent(OpenstackSecurityGroupEvent.Type type,
71 SecurityGroup sg,
Hyunsun Moonae51e732017-04-25 17:46:21 +090072 SecurityGroupRule sgRule) {
73 super(type, sg);
sangho6a9ff0d2017-03-27 11:23:37 +090074 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}