aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java
new file mode 100644
index 0000000..201cc77
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.usecaseui.intentanalysis.controller;
+
+import lombok.extern.log4j.Log4j2;
+import org.onap.usecaseui.intentanalysis.bean.models.ResultHeader;
+import org.onap.usecaseui.intentanalysis.bean.models.ServiceResult;
+import org.onap.usecaseui.intentanalysis.service.IntentInstanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import static org.onap.usecaseui.intentanalysis.common.ResponseConsts.RSEPONSE_SUCCESS;
+
+@Log4j2
+@RestController
+@RequestMapping("/intent/instance")
+public class IntentInstanceController {
+ @Autowired
+ private IntentInstanceService intentInstanceService;
+
+ @GetMapping(value = "/{intentInstanceId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ServiceResult getIntentById(
+ @PathVariable("intentInstanceId") String intentInstanceId) {
+ return new ServiceResult(new ResultHeader(RSEPONSE_SUCCESS, "Get Intent Instance Success"),
+ intentInstanceService.getIntentInstance(intentInstanceId));
+ }
+} \ No newline at end of file