2 * Copyright © 2018 IBM.
3 * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 package org.onap.ccsdk.cds.controllerblueprints.resource.dict
20 import com.fasterxml.jackson.annotation.JsonFormat
21 import com.fasterxml.jackson.annotation.JsonProperty
22 import com.fasterxml.jackson.databind.JsonNode
23 import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
24 import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
25 import java.io.Serializable
28 open class ResourceDefinition {
30 @JsonProperty(value = "name", required = true)
31 lateinit var name: String
33 @JsonProperty(value = "property", required = true)
34 lateinit var property: PropertyDefinition
36 var tags: String? = null
38 /** The default group for Resource Definition is "default" */
39 @JsonProperty(value = "group", required = true)
40 var group: String = "default"
42 @JsonProperty(value = "updated-by")
43 lateinit var updatedBy: String
45 @JsonProperty(value = "sources", required = true)
46 lateinit var sources: MutableMap<String, NodeTemplate>
49 open class ResourceAssignment {
51 @JsonProperty(value = "name", required = true)
52 lateinit var name: String
54 @JsonProperty(value = "property")
55 var property: PropertyDefinition? = null
57 @JsonProperty("input-param")
58 var inputParameter: Boolean = false
60 @JsonProperty("dictionary-name")
61 var dictionaryName: String? = null
63 @JsonProperty("dictionary-source")
64 var dictionarySource: String? = null
66 /** Modified Source definition, Capability Source will use for script reference changes,
67 * Rest Source will use for extra headers etc **/
68 @JsonProperty("dictionary-source-definition")
69 var dictionarySourceDefinition: NodeTemplate? = null
71 /** Duplicate field : Shall be used directly from Dictionary Source definition dependencies. **/
72 @JsonProperty("dependencies")
73 var dependencies: MutableList<String>? = null
75 @JsonProperty("version")
78 @JsonProperty("status")
79 var status: String? = null
81 @JsonProperty("message")
82 var message: String? = null
84 @JsonProperty("updated-date")
85 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
86 var updatedDate: Date? = null
88 @JsonProperty("updated-by")
89 var updatedBy: String? = null
91 /** input & output key-mapping with their resolved values **/
92 var keyIdentifiers: MutableList<KeyIdentifier> = mutableListOf()
94 override fun toString(): String {
99 required = ${property?.required}
100 dependencies = $dependencies
101 dictionaryName = $dictionaryName
102 dictionarySource = $dictionarySource
108 data class KeyIdentifier(val name: String, val value: JsonNode)
109 data class DictionaryMetadataEntry(val name: String, val value: String)
111 * Data class for exposing summary of resource resolution
113 data class ResolutionSummary(
116 val required: Boolean,
118 @JsonProperty("key-identifiers")
119 val keyIdentifiers: MutableList<KeyIdentifier>,
120 @JsonProperty("dictionary-description")
121 val dictionaryDescription: String,
122 @JsonProperty("dictionary-metadata")
123 val dictionaryMetadata: MutableList<DictionaryMetadataEntry>,
124 @JsonProperty("dictionary-name")
125 val dictionaryName: String,
126 @JsonProperty("dictionary-source")
127 val dictionarySource: String,
128 @JsonProperty("request-payload")
129 val requestPayload: JsonNode,
130 @JsonProperty("status")
132 @JsonProperty("message")
136 * Interface for Source Definitions (ex Input Source,
137 * Default Source, Database Source, Rest Sources, etc)
139 interface ResourceSource : Serializable
141 open class ResourceSourceMapping {
142 lateinit var resourceSourceMappings: MutableMap<String, String>