blob: 1445591b8ac6f06877244499222a6ba84ce7f0b9 [file] [log] [blame]
Jian Li1c10cf22021-03-05 01:32:04 +09001/*
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 */
16package org.onosproject.kubevirtnetworking.api;
17
18import org.onosproject.event.AbstractEvent;
19
20/**
21 * Describes kubevirt security group event.
22 */
23public class KubevirtSecurityGroupEvent
24 extends AbstractEvent<KubevirtSecurityGroupEvent.Type, KubevirtSecurityGroup> {
25
26 private KubevirtSecurityGroupRule sgRule;
27
28 /**
29 * SecurityGroupEvent constructor.
30 *
31 * @param type SecurityGroupEvent type
32 * @param sg SecurityGroup object
33 */
34 public KubevirtSecurityGroupEvent(Type type, KubevirtSecurityGroup sg) {
35 super(type, sg);
36 }
37
38 /**
39 * SecurityGroupEvent constructor.
40 *
41 * @param type SecurityGroupEvent type
42 * @param sg SecurityGroup object
43 * @param sgRule SecurityGroupRule object
44 */
45 public KubevirtSecurityGroupEvent(Type type, KubevirtSecurityGroup sg,
46 KubevirtSecurityGroupRule sgRule) {
47 super(type, sg);
48 this.sgRule = sgRule;
49 }
50
51 /**
52 * Returns security group rule.
53 *
54 * @return SecurityGroupRule
55 */
56 public KubevirtSecurityGroupRule rule() {
57 return this.sgRule;
58 }
59
60 public enum Type {
61 /**
62 * Signifies that a new kubevirt security group is created.
63 */
64 KUBEVIRT_SECURITY_GROUP_CREATED,
65
66 /**
67 * Signifies that the kubevirt security group is removed.
68 */
69 KUBEVIRT_SECURITY_GROUP_REMOVED,
70
71 /**
72 * Signifies that a new kubevirt security group rule is created.
73 */
74 KUBEVIRT_SECURITY_GROUP_RULE_CREATED,
75
76 /**
77 * Signifies that the kubevirt security group rule is removed.
78 */
79 KUBEVIRT_SECURITY_GROUP_RULE_REMOVED,
80 }
81}