2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.vid.controller;
24 import java.util.UUID;
25 import javax.servlet.http.HttpServletRequest;
26 import org.onap.vid.dal.AsyncInstantiationRepository;
27 import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
28 import org.onap.vid.services.AsyncInstantiationBusinessLogic;
29 import org.onap.vid.services.InstantiationTemplatesService;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.web.bind.annotation.GetMapping;
32 import org.springframework.web.bind.annotation.PathVariable;
33 import org.springframework.web.bind.annotation.RequestMapping;
34 import org.springframework.web.bind.annotation.RestController;
37 @RequestMapping(InstantiationTemplatesController.INSTANTIATION_TEMPLATES)
38 public class InstantiationTemplatesController extends VidRestrictedBaseController {
40 public static final String INSTANTIATION_TEMPLATES = "instantiationTemplates";
42 protected final AsyncInstantiationBusinessLogic asyncInstantiationBL;
43 protected final InstantiationTemplatesService instantiationTemplates;
44 protected final AsyncInstantiationRepository asyncInstantiationRepository;
48 public InstantiationTemplatesController(AsyncInstantiationBusinessLogic asyncInstantiationBL,
49 InstantiationTemplatesService instantiationTemplates,
50 AsyncInstantiationRepository asyncInstantiationRepository) {
51 this.asyncInstantiationBL = asyncInstantiationBL;
52 this.instantiationTemplates = instantiationTemplates;
53 this.asyncInstantiationRepository = asyncInstantiationRepository;
56 @GetMapping("templateTopology/{jobId}")
57 public ServiceInstantiation getTemplateTopology(HttpServletRequest request, @PathVariable(value="jobId") UUID jobId) {
58 return instantiationTemplates.getJobRequestAsTemplate(jobId);