2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============================LICENSE_END===========================================
21 package org.openecomp.dcae.apod.analytics.cdap.plugins.domain.config.tca;
23 import co.cask.cdap.api.annotation.Description;
24 import co.cask.cdap.api.annotation.Macro;
25 import com.google.common.base.Objects;
26 import org.openecomp.dcae.apod.analytics.cdap.common.settings.CDAPBasePluginConfig;
28 import javax.annotation.Nullable;
31 * Simple TCA Plugin Configuration
33 * @author Rajiv Singla . Creation Date: 2/13/2017.
35 public class SimpleTCAPluginConfig extends CDAPBasePluginConfig {
37 private static final long serialVersionUID = 1L;
39 @Description("Field name containing VES Message")
41 protected String vesMessageFieldName;
43 @Description("Policy JSON that need to be applied to VES Message")
45 protected String policyJson;
47 @Description("Name of the output field that will contain the alert")
49 protected String alertFieldName;
51 @Description("Name of the output field that will contain message type: INAPPLICABLE, COMPLIANT, NON_COMPLIANT")
53 protected String messageTypeFieldName;
55 @Description("Specifies the output schema")
56 protected String schema;
58 @Description("Enables")
61 protected Boolean enableAlertCEFFormat;
65 * Creates an instance of TCA Plugin Configs
67 * @param vesMessageFieldName Ves message field name from incoming plugin schema
68 * @param policyJson TCA Policy Json String
69 * @param alertFieldName Alert field name that will be added in TCA plugin output schema
70 * @param messageTypeFieldName Message type field name that will be added in TCA plugin output schema
71 * @param schema TCA Plugin output schema
72 * @param enableAlertCEFFormat enables alert message to be formatted in VES format
74 public SimpleTCAPluginConfig(final String vesMessageFieldName, final String policyJson,
75 final String alertFieldName, final String messageTypeFieldName,
76 final String schema, final Boolean enableAlertCEFFormat) {
77 this.vesMessageFieldName = vesMessageFieldName;
78 this.policyJson = policyJson;
79 this.alertFieldName = alertFieldName;
80 this.messageTypeFieldName = messageTypeFieldName;
82 this.enableAlertCEFFormat = enableAlertCEFFormat;
86 * Name of the field containing VES Message
88 * @return VES Message field name
90 public String getVesMessageFieldName() {
91 return vesMessageFieldName;
97 * @return Policy Json String
99 public String getPolicyJson() {
105 * Alert Field name in outgoing schema
107 * @return alert field name in outgoing schema
109 public String getAlertFieldName() {
110 return alertFieldName;
114 * Returns output schema string
116 * @return output schema string
118 public String getSchema() {
123 * Return TCA message type - INAPPLICABLE, COMPLIANT, NON_COMPLIANT
125 * @return tca message type
127 public String getMessageTypeFieldName() {
128 return messageTypeFieldName;
133 * Returns if Alert output in Common Event format
135 * @return true if alert output is in common event format
138 public Boolean getEnableAlertCEFFormat() {
139 return enableAlertCEFFormat;
143 public String toString() {
144 return Objects.toStringHelper(this)
145 .add("referenceName", referenceName)
146 .add("vesMessageFieldName", vesMessageFieldName)
147 .add("policyJson", policyJson)
148 .add("alertFieldName", alertFieldName)
149 .add("messageTypeFieldName", messageTypeFieldName)
150 .add("schema", schema)
151 .add("enableAlertCEFFormat", true)