2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2025 OpenInfra Foundation Europe
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.ncmp.dmi.rest.stub.controller;
24 import jakarta.servlet.http.HttpServletRequest;
25 import java.util.List;
26 import lombok.RequiredArgsConstructor;
27 import org.onap.cps.ncmp.dmi.provmns.api.ProvMnS;
28 import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
29 import org.onap.cps.ncmp.dmi.provmns.model.Resource;
30 import org.onap.cps.ncmp.dmi.provmns.model.ResourceOneOf;
31 import org.onap.cps.ncmp.dmi.provmns.model.Scope;
32 import org.springframework.http.HttpStatus;
33 import org.springframework.http.ResponseEntity;
34 import org.springframework.web.bind.annotation.RequestMapping;
35 import org.springframework.web.bind.annotation.RestController;
38 @RequestMapping("${rest.api.provmns-base-path}")
39 @RequiredArgsConstructor
40 public class ProvMnsStubController implements ProvMnS {
43 * Replaces a complete single resource or creates it if it does not exist.
45 * @param httpServletRequest URI request including path
46 * @param resource Resource representation of the resource to be created or replaced
47 * @return {@code ResponseEntity} The representation of the updated resource is returned in the response
51 public ResponseEntity<Resource> putMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
52 return new ResponseEntity<>(resource, HttpStatus.OK);
56 * Reads one or multiple resources.
58 * @param httpServletRequest URI request including path
59 * @param scope Extends the set of targeted resources beyond the base
60 * resource identified with the authority and path component of
62 * @param filter Reduces the targeted set of resources by applying a filter to
63 * the scoped set of resource representations. Only resources
64 * representations for which the filter construct evaluates to
65 * "true" are targeted.
66 * @param attributes Attributes of the scoped resources to be returned. The
67 * value is a comma-separated list of attribute names.
68 * @param fields Attribute fields of the scoped resources to be returned. The
69 * value is a comma-separated list of JSON pointers to the
71 * @param dataNodeSelector dataNodeSelector object
72 * @return {@code ResponseEntity} The resources identified in the request for retrieval are returned
73 * in the response message body.
76 public ResponseEntity<Resource> getMoi(final HttpServletRequest httpServletRequest, final Scope scope,
77 final String filter, final List<String> attributes,
78 final List<String> fields,
79 final ClassNameIdGetDataNodeSelectorParameter dataNodeSelector) {
80 return new ResponseEntity<>(new ResourceOneOf("exampleResourceId"), HttpStatus.OK);
84 * Patches (Create, Update or Delete) one or multiple resources.
86 * @param httpServletRequest URI request including path
87 * @param resource Resource representation of the resource to be created or replaced
88 * @return {@code ResponseEntity} The updated resource representations are returned in the response message body.
91 public ResponseEntity<Resource> patchMoi(final HttpServletRequest httpServletRequest, final Resource resource) {
92 return new ResponseEntity<>(resource, HttpStatus.OK);
96 * Delete one or multiple resources.
98 * @param httpServletRequest URI request including path
99 * @return {@code ResponseEntity} The response body is empty, HTTP status returned.
102 public ResponseEntity<Void> deleteMoi(final HttpServletRequest httpServletRequest) {
103 return new ResponseEntity<>(HttpStatus.OK);