b4d68cbca1e37cea9a0293c034ac9aab49558445
[ccsdk/apps.git] /
1 /*
2  *  Copyright © 2018 IBM.
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
17 package org.onap.ccsdk.apps.controllerblueprints.resource.dict
18
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import com.fasterxml.jackson.annotation.JsonProperty
21 import org.apache.commons.lang3.builder.ToStringBuilder
22 import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
23 import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
24 import java.io.Serializable
25 import java.util.*
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 = "updated-by")
38     lateinit var updatedBy: String
39
40     @JsonProperty(value = "resource-type", required = true)
41     lateinit var resourceType: String
42
43     @JsonProperty(value = "resource-path", required = true)
44     lateinit var resourcePath: String
45
46     @JsonProperty(value = "sources", required = true)
47     lateinit var sources: MutableMap<String, NodeTemplate>
48 }
49
50 open class ResourceAssignment {
51
52     @JsonProperty(value = "name", required = true)
53     lateinit var name: String
54
55     @JsonProperty(value = "property")
56     var property: PropertyDefinition? = null
57
58     @JsonProperty("input-param")
59     var inputParameter: Boolean = false
60
61     @JsonProperty("dictionary-name")
62     var dictionaryName: String? = null
63
64     @JsonProperty("dictionary-source")
65     var dictionarySource: String? = null
66
67     @JsonProperty("dependencies")
68     var dependencies: MutableList<String>? = null
69
70     @JsonProperty("version")
71     var version: Int = 0
72
73     @JsonProperty("status")
74     var status: String? = null
75
76     @JsonProperty("message")
77     var message: String? = null
78
79     @JsonProperty("updated-date")
80     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
81     var updatedDate: Date? = null
82
83     @JsonProperty("updated-by")
84     var updatedBy: String? = null
85
86     override fun toString(): String {
87         return StringBuilder()
88                 .append("[")
89                 .append("name=", name)
90                 .append(", dictionaryName=", dictionaryName)
91                 .append(", dictionarySource=", dictionarySource)
92                 .append("]")
93                 .toString()
94     }
95 }
96
97 /**
98  * Interface for Source Definitions (ex Input Source,
99  * Default Source, Database Source, Rest Sources, etc)
100  */
101 interface ResourceSource : Serializable