0a67e878dbcafa2d506fd53eefdfb92d2a3ff590
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
18
19 import io.swagger.annotations.ApiOperation
20 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
21 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
22 import org.springframework.beans.factory.annotation.Autowired
23 import org.springframework.http.MediaType
24 import org.springframework.web.bind.annotation.*
25 import reactor.core.publisher.Mono
26
27 @RestController
28 @RequestMapping("/api/v1/execution-service")
29 class ExecutionServiceController {
30
31     @Autowired
32     lateinit var executionServiceHandler: ExecutionServiceHandler
33
34
35     @RequestMapping(path = arrayOf("/ping"), method = arrayOf(RequestMethod.GET), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
36     @ResponseBody
37     fun ping(): Mono<String> {
38         return Mono.just("Success")
39     }
40
41     @RequestMapping(path = arrayOf("/process"), method = arrayOf(RequestMethod.POST), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
42     @ApiOperation(value = "Resolve Resource Mappings", notes = "Takes the blueprint information and process as per the payload")
43     @ResponseBody
44     fun process(@RequestBody executionServiceInput: ExecutionServiceInput): Mono<ExecutionServiceOutput> {
45         val executionServiceOutput = executionServiceHandler.process(executionServiceInput)
46         return Mono.just(executionServiceOutput)
47     }
48 }