add group notation to resource dictionary
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / blueprints / resource-dict / src / main / kotlin / org / onap / ccsdk / cds / controllerblueprints / resource / dict / ResourceDefinition.kt
1 /*
2  *  Copyright © 2018 IBM.
3  *  Modifications Copyright © 2017-2018 AT&T Intellectual Property.
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */
17
18 package org.onap.ccsdk.cds.controllerblueprints.resource.dict
19
20 import com.fasterxml.jackson.annotation.JsonFormat
21 import com.fasterxml.jackson.annotation.JsonProperty
22 import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
23 import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
24 import java.io.Serializable
25 import java.util.Date
26
27 open class ResourceDefinition {
28
29     @JsonProperty(value = "name", required = true)
30     lateinit var name: String
31
32     @JsonProperty(value = "property", required = true)
33     lateinit var property: PropertyDefinition
34
35     var tags: String? = null
36
37     @JsonProperty(value = "group")
38     lateinit var group: String
39
40     @JsonProperty(value = "updated-by")
41     lateinit var updatedBy: String
42
43     @JsonProperty(value = "sources", required = true)
44     lateinit var sources: MutableMap<String, NodeTemplate>
45 }
46
47 open class ResourceAssignment {
48
49     @JsonProperty(value = "name", required = true)
50     lateinit var name: String
51
52     @JsonProperty(value = "property")
53     var property: PropertyDefinition? = null
54
55     @JsonProperty("input-param")
56     var inputParameter: Boolean = false
57
58     @JsonProperty("dictionary-name")
59     var dictionaryName: String? = null
60
61     @JsonProperty("dictionary-source")
62     var dictionarySource: String? = null
63
64     /** Modified Source definition,  Capability Source will use for script reference changes,
65      * Rest Source will use for extra headers etc **/
66     @JsonProperty("dictionary-source-definition")
67     var dictionarySourceDefinition: NodeTemplate? = null
68
69     /** Duplicate field : Shall be used directly from Dictionary Source definition dependencies. **/
70     @JsonProperty("dependencies")
71     var dependencies: MutableList<String>? = null
72
73     @JsonProperty("version")
74     var version: Int = 0
75
76     @JsonProperty("status")
77     var status: String? = null
78
79     @JsonProperty("message")
80     var message: String? = null
81
82     @JsonProperty("updated-date")
83     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
84     var updatedDate: Date? = null
85
86     @JsonProperty("updated-by")
87     var updatedBy: String? = null
88
89     override fun toString(): String {
90         return """
91             [
92                 name = $name
93                 status = $status
94                 required = ${property?.required}
95                 dependencies = $dependencies
96                 dictionaryName = $dictionaryName
97                 dictionarySource = $dictionarySource
98             ]
99             """.trimIndent()
100     }
101 }
102
103 /**
104  * Interface for Source Definitions (ex Input Source,
105  * Default Source, Database Source, Rest Sources, etc)
106  */
107 interface ResourceSource : Serializable
108
109 open class ResourceSourceMapping {
110     lateinit var resourceSourceMappings: MutableMap<String, String>
111 }