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 io.swagger.annotations.ApiModel
24 import io.swagger.annotations.ApiModelProperty
25 import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
26 import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
27 import java.io.Serializable
31 open class ResourceDefinition {
33 @JsonProperty(value = "name", required = true)
34 @ApiModelProperty(value = "Name", required = true, example = "\"default-source\"")
35 lateinit var name: String
37 @JsonProperty(value = "property", required = true)
38 @ApiModelProperty(value = "Property", required = true)
39 lateinit var property: PropertyDefinition
41 var tags: String? = null
43 /** The default group for Resource Definition is "default" */
44 @JsonProperty(value = "group", required = true)
45 @ApiModelProperty(value = "Group", required = true, example = "\"default\"")
46 var group: String = "default"
48 @JsonProperty(value = "updated-by")
49 @ApiModelProperty(value = "Updated by", required = true, example = "\"example@onap.com\"")
50 lateinit var updatedBy: String
52 @JsonProperty(value = "sources", required = true)
53 @ApiModelProperty(value = "Sources", required = true, example = "\"sources\"")
54 lateinit var sources: MutableMap<String, NodeTemplate>
57 open class ResourceAssignment {
59 @JsonProperty(value = "name", required = true)
60 lateinit var name: String
62 @JsonProperty(value = "property")
63 var property: PropertyDefinition? = null
65 @JsonProperty(value = "max-occurrence")
66 var maxOccurrence: Int? = null
68 @JsonProperty("input-param")
69 var inputParameter: Boolean = false
71 @JsonProperty("dictionary-name")
72 var dictionaryName: String? = null
74 @JsonProperty("dictionary-source")
75 var dictionarySource: String? = null
77 /** Modified Source definition, Capability Source will use for script reference changes,
78 * Rest Source will use for extra headers etc **/
79 @JsonProperty("dictionary-source-definition")
80 var dictionarySourceDefinition: NodeTemplate? = null
82 /** Duplicate field : Shall be used directly from Dictionary Source definition dependencies. **/
83 @JsonProperty("dependencies")
84 var dependencies: MutableList<String>? = null
86 @JsonProperty("version")
89 @JsonProperty("status")
90 var status: String? = null
92 @JsonProperty("message")
93 var message: String? = null
95 @JsonProperty("updated-date")
96 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
97 var updatedDate: Date? = null
99 @JsonProperty("updated-by")
100 var updatedBy: String? = null
102 /** input & output key-mapping with their resolved values **/
103 var keyIdentifiers: MutableList<KeyIdentifier> = mutableListOf()
105 override fun toString(): String {
110 required = ${property?.required}
111 dependencies = $dependencies
112 dictionaryName = $dictionaryName
113 dictionarySource = $dictionarySource
119 data class KeyIdentifier(val name: String, val value: JsonNode)
120 data class DictionaryMetadataEntry(val name: String, val value: String)
123 * Data class for exposing summary of resource resolution
125 data class ResolutionSummary(
128 val required: Boolean,
130 @JsonProperty("key-identifiers")
131 val keyIdentifiers: MutableList<KeyIdentifier>,
132 @JsonProperty("dictionary-description")
133 val dictionaryDescription: String,
134 @JsonProperty("dictionary-metadata")
135 val dictionaryMetadata: MutableList<DictionaryMetadataEntry>,
136 @JsonProperty("dictionary-name")
137 val dictionaryName: String,
138 @JsonProperty("dictionary-source")
139 val dictionarySource: String,
140 @JsonProperty("request-payload")
141 val requestPayload: JsonNode,
142 @JsonProperty("status")
144 @JsonProperty("message")
149 * Interface for Source Definitions (ex Input Source,
150 * Default Source, Database Source, Rest Sources, etc)
152 interface ResourceSource : Serializable
154 open class ResourceSourceMapping {
156 lateinit var resourceSourceMappings: MutableMap<String, String>