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