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("input-param")
66 var inputParameter: Boolean = false
68 @JsonProperty("dictionary-name")
69 var dictionaryName: String? = null
71 @JsonProperty("dictionary-source")
72 var dictionarySource: String? = null
74 /** Modified Source definition, Capability Source will use for script reference changes,
75 * Rest Source will use for extra headers etc **/
76 @JsonProperty("dictionary-source-definition")
77 var dictionarySourceDefinition: NodeTemplate? = null
79 /** Duplicate field : Shall be used directly from Dictionary Source definition dependencies. **/
80 @JsonProperty("dependencies")
81 var dependencies: MutableList<String>? = null
83 @JsonProperty("version")
86 @JsonProperty("status")
87 var status: String? = null
89 @JsonProperty("message")
90 var message: String? = null
92 @JsonProperty("updated-date")
93 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
94 var updatedDate: Date? = null
96 @JsonProperty("updated-by")
97 var updatedBy: String? = null
99 /** input & output key-mapping with their resolved values **/
100 var keyIdentifiers: MutableList<KeyIdentifier> = mutableListOf()
102 override fun toString(): String {
107 required = ${property?.required}
108 dependencies = $dependencies
109 dictionaryName = $dictionaryName
110 dictionarySource = $dictionarySource
116 data class KeyIdentifier(val name: String, val value: JsonNode)
117 data class DictionaryMetadataEntry(val name: String, val value: String)
120 * Data class for exposing summary of resource resolution
122 data class ResolutionSummary(
125 val required: Boolean,
127 @JsonProperty("key-identifiers")
128 val keyIdentifiers: MutableList<KeyIdentifier>,
129 @JsonProperty("dictionary-description")
130 val dictionaryDescription: String,
131 @JsonProperty("dictionary-metadata")
132 val dictionaryMetadata: MutableList<DictionaryMetadataEntry>,
133 @JsonProperty("dictionary-name")
134 val dictionaryName: String,
135 @JsonProperty("dictionary-source")
136 val dictionarySource: String,
137 @JsonProperty("request-payload")
138 val requestPayload: JsonNode,
139 @JsonProperty("status")
141 @JsonProperty("message")
146 * Interface for Source Definitions (ex Input Source,
147 * Default Source, Database Source, Rest Sources, etc)
149 interface ResourceSource : Serializable
151 open class ResourceSourceMapping {
153 lateinit var resourceSourceMappings: MutableMap<String, String>