4ed98ddd0bb81d59c950601afbe0f5930ed39274
[ccsdk/cds.git] /
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     /** The default group for Resource Definition is "default" */
38     @JsonProperty(value = "group", required = true)
39     var group: String = "default"
40
41     @JsonProperty(value = "updated-by")
42     lateinit var updatedBy: String
43
44     @JsonProperty(value = "sources", required = true)
45     lateinit var sources: MutableMap<String, NodeTemplate>
46 }
47
48 open class ResourceAssignment {
49
50     @JsonProperty(value = "name", required = true)
51     lateinit var name: String
52
53     @JsonProperty(value = "property")
54     var property: PropertyDefinition? = null
55
56     @JsonProperty("input-param")
57     var inputParameter: Boolean = false
58
59     @JsonProperty("dictionary-name")
60     var dictionaryName: String? = null
61
62     @JsonProperty("dictionary-source")
63     var dictionarySource: String? = null
64
65     /** Modified Source definition,  Capability Source will use for script reference changes,
66      * Rest Source will use for extra headers etc **/
67     @JsonProperty("dictionary-source-definition")
68     var dictionarySourceDefinition: NodeTemplate? = null
69
70     /** Duplicate field : Shall be used directly from Dictionary Source definition dependencies. **/
71     @JsonProperty("dependencies")
72     var dependencies: MutableList<String>? = null
73
74     @JsonProperty("version")
75     var version: Int = 0
76
77     @JsonProperty("status")
78     var status: String? = null
79
80     @JsonProperty("message")
81     var message: String? = null
82
83     @JsonProperty("updated-date")
84     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
85     var updatedDate: Date? = null
86
87     @JsonProperty("updated-by")
88     var updatedBy: String? = null
89
90     override fun toString(): String {
91         return """
92             [
93                 name = $name
94                 status = $status
95                 required = ${property?.required}
96                 dependencies = $dependencies
97                 dictionaryName = $dictionaryName
98                 dictionarySource = $dictionarySource
99             ]
100             """.trimIndent()
101     }
102 }
103
104 /**
105  * Interface for Source Definitions (ex Input Source,
106  * Default Source, Database Source, Rest Sources, etc)
107  */
108 interface ResourceSource : Serializable
109
110 open class ResourceSourceMapping {
111     lateinit var resourceSourceMappings: MutableMap<String, String>
112 }