2 * Copyright © 2017-2018 AT&T Intellectual Property.
3 * Modifications Copyright © 2018 IBM.
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.blueprintsprocessor.core.api.data
20 import com.fasterxml.jackson.annotation.JsonFormat
21 import com.fasterxml.jackson.annotation.JsonIgnore
22 import com.fasterxml.jackson.databind.JsonNode
23 import com.fasterxml.jackson.databind.node.ObjectNode
24 import io.swagger.annotations.ApiModelProperty
28 * BlueprintProcessorData
29 * @author Brinda Santh
33 open class ExecutionServiceInput {
34 @get:ApiModelProperty(required = true, value = "Headers providing request context.")
35 lateinit var commonHeader: CommonHeader
36 @get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
37 lateinit var actionIdentifiers: ActionIdentifiers
38 @get:ApiModelProperty(required = true,
39 value = "Contain the information to be passed as input to the action." +
40 "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
41 " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
42 lateinit var payload: ObjectNode
43 @get:ApiModelProperty(hidden = true)
45 var stepData: StepData? = null
48 open class ExecutionServiceOutput {
49 @get:ApiModelProperty(required = true, value = "Headers providing request context.")
50 lateinit var commonHeader: CommonHeader
51 @get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
52 lateinit var actionIdentifiers: ActionIdentifiers
53 @get:ApiModelProperty(required = true, value = "Status of the request.")
54 lateinit var status: Status
55 @get:ApiModelProperty(required = true,
56 value = "Contain the information to be passed as input to the action." +
57 "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
58 " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
59 lateinit var payload: ObjectNode
60 @get:ApiModelProperty(hidden = true)
62 var stepData: StepData? = null
65 const val ACTION_MODE_ASYNC = "async"
66 const val ACTION_MODE_SYNC = "sync"
68 open class ActionIdentifiers {
69 @get:ApiModelProperty(required = false, value = "Name of the CBA.")
70 lateinit var blueprintName: String
71 @get:ApiModelProperty(required = false, value = "Version of the CBA.")
72 lateinit var blueprintVersion: String
73 @get:ApiModelProperty(required = true, value = "Name of the workflow to execute.")
74 lateinit var actionName: String
75 @get:ApiModelProperty(required = true,
76 value = "Async processing is only supported for gRPC client.",
77 allowableValues = "sync, async")
78 lateinit var mode: String
81 open class CommonHeader {
82 @get:ApiModelProperty(required = true, value = "Date of the execution", example = "2012-04-23T18:25:43.511Z")
83 @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
84 var timestamp: Date = Date()
85 @get:ApiModelProperty(required = true, value = "Identify the system/person triggering the request.")
86 lateinit var originatorId: String
87 @get:ApiModelProperty(required = true, value = "Uniquely identify a request.")
88 lateinit var requestId: String
89 @get:ApiModelProperty(required = true, value = "Allow for fine-grain request identifier")
90 lateinit var subRequestId: String
91 @get:ApiModelProperty(required = false, hidden = true)
92 var flags: Flags? = null
96 @get:ApiModelProperty(value = "Whether or not to force the action.")
97 var isForce: Boolean = false
98 @get:ApiModelProperty(value = "3600")
103 @get:ApiModelProperty(required = true, value = "HTTP status code equivalent.")
105 @get:ApiModelProperty(required = true, value = "Type of the event being emitted by CDS.")
106 var eventType: String = ""
107 @get:ApiModelProperty(required = true,
108 value = "Time when the execution ended.",
109 example = "2012-04-23T18:25:43.511Z")
110 @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
111 var timestamp: Date = Date()
112 @get:ApiModelProperty(required = false, value = "Error message when system failed")
113 var errorMessage: String? = null
114 @get:ApiModelProperty(required = true, value = "Message providing request status")
115 var message: String = "success"
118 open class StepData {
119 lateinit var name: String
120 var properties: MutableMap<String, JsonNode> = mutableMapOf()