add python compatibility module
[ccsdk/apps.git] / ms / blueprintsprocessor / modules / commons / processor-core / src / main / kotlin / org / onap / ccsdk / apps / 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.apps.blueprintsprocessor.core.api.data
19
20 import com.fasterxml.jackson.annotation.JsonFormat
21 import com.fasterxml.jackson.databind.node.ObjectNode
22 import io.swagger.annotations.ApiModelProperty
23 import java.util.*
24
25 /**
26  * BlueprintProcessorData
27  * @author Brinda Santh
28  * DATE : 8/15/2018
29  */
30
31 open class ExecutionServiceInput {
32     @get:ApiModelProperty(required = true)
33     lateinit var commonHeader: CommonHeader
34     @get:ApiModelProperty(required = true)
35     lateinit var actionIdentifiers: ActionIdentifiers
36     @get:ApiModelProperty(required = true)
37     lateinit var payload: ObjectNode
38 }
39
40 open class ExecutionServiceOutput {
41     @get:ApiModelProperty(required = true)
42     lateinit var commonHeader: CommonHeader
43     @get:ApiModelProperty(required = true)
44     lateinit var actionIdentifiers: ActionIdentifiers
45     @get:ApiModelProperty(required = true)
46     var status: Status = Status()
47     @get:ApiModelProperty(required = true)
48     lateinit var payload: ObjectNode
49 }
50
51 const val ACTION_MODE_ASYNC = "async"
52 const val ACTION_MODE_SYNC = "sync"
53
54 open class ActionIdentifiers {
55     @get:ApiModelProperty(required = false)
56     lateinit var blueprintName: String
57     @get:ApiModelProperty(required = false)
58     lateinit var blueprintVersion: String
59     @get:ApiModelProperty(required = true)
60     lateinit var actionName: String
61     @get:ApiModelProperty(required = true, allowableValues = "sync, async")
62     lateinit var mode: String
63 }
64
65 open class CommonHeader {
66     @get:ApiModelProperty(required = true, example = "2012-04-23T18:25:43.511Z")
67     @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
68     var timestamp: Date = Date()
69     @get:ApiModelProperty(required = true)
70     lateinit var originatorId: String
71     @get:ApiModelProperty(required = true)
72     lateinit var requestId: String
73     @get:ApiModelProperty(required = true)
74     lateinit var subRequestId: String
75     @get:ApiModelProperty(required = false)
76     var flags: Flags? = null
77 }
78
79 open class Flags {
80     var isForce: Boolean = false
81     @get:ApiModelProperty(value = "3600")
82     var ttl: Int = 3600
83 }
84
85 open class Status {
86     @get:ApiModelProperty(required = true)
87     var code: Int = 200
88     @get:ApiModelProperty(required = true)
89     var eventType: String = "EVENT-ACTION-RESPONSE"
90     @get:ApiModelProperty(required = true, example = "2012-04-23T18:25:43.511Z")
91     @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
92     var timestamp: Date = Date()
93     @get:ApiModelProperty(required = false)
94     var errorMessage: String? = null
95     @get:ApiModelProperty(required = true)
96     var message: String = "success"
97 }
98
99 open class BluePrintManagementInput {
100     @get:ApiModelProperty(required = true)
101     lateinit var commonHeader: CommonHeader
102     @get:ApiModelProperty(required = false)
103     lateinit var blueprintName: String
104     @get:ApiModelProperty(required = false)
105     lateinit var blueprintVersion: String
106     @get:ApiModelProperty(required = true)
107     lateinit var fileChunk: FileChunk
108 }
109
110 open class FileChunk {
111     @get:ApiModelProperty(required = true)
112     lateinit var chunk: ByteArray
113 }
114
115 open class BluePrintManagementOutput {
116     @get:ApiModelProperty(required = true)
117     lateinit var commonHeader: CommonHeader
118     @get:ApiModelProperty(required = true)
119     var status: Status = Status()
120 }
121
122
123