a0380052111e46e43b07d507c7a2ee799d75e153
[cps/ncmp-dmi-plugin.git] /
1 /*
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
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  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.ncmp.dmi.rest.stub.controller;
22
23 import java.util.List;
24 import org.onap.cps.ncmp.dmi.provmns.model.ClassNameIdGetDataNodeSelectorParameter;
25 import org.onap.cps.ncmp.dmi.provmns.model.Resource;
26 import org.onap.cps.ncmp.dmi.provmns.model.ResourceOneOf;
27 import org.onap.cps.ncmp.dmi.provmns.model.Scope;
28 import org.onap.cps.ncmp.dmi.provmns.rest.api.DefaultApi;
29 import org.springframework.http.HttpStatus;
30 import org.springframework.http.ResponseEntity;
31
32 public class ProvMnsStubController implements DefaultApi {
33
34     /**
35      * Replaces a complete single resource or creates it if it does not exist.
36      *
37      * @param className               Class name of the targeted resource
38      * @param id                      Identifier of the targeted resource
39      * @param resource                Resource representation of the resource to be created or replaced
40      * @return {@code ResponseEntity} The representation of the updated resource is returned in the response
41      *                                message body.
42      */
43     @Override
44     public ResponseEntity<Resource> classNameidPut(final String className, final String id, final Resource resource) {
45         return new ResponseEntity<>(resource, HttpStatus.OK);
46     }
47
48     /**
49      * Reads one or multiple resources.
50      *
51      * @param className        Class name of the targeted resource
52      * @param id               Identifier of the targeted resource
53      * @param scope            Extends the set of targeted resources beyond the base
54      *                         resource identified with the authority and path component of
55      *                         the URI.
56      * @param filter           Reduces the targeted set of resources by applying a filter to
57      *                         the scoped set of resource representations. Only resources
58      *                         representations for which the filter construct evaluates to
59      *                         "true" are targeted.
60      * @param attributes       Attributes of the scoped resources to be returned. The
61      *                         value is a comma-separated list of attribute names.
62      * @param fields           Attribute fields of the scoped resources to be returned. The
63      *                         value is a comma-separated list of JSON pointers to the
64      *                         attribute fields.
65      * @param dataNodeSelector dataNodeSelector object
66      * @return {@code ResponseEntity} The resources identified in the request for retrieval are returned
67      *                         in the response message body.
68      */
69     @Override
70     public ResponseEntity<Resource> classNameidGet(final String className, final String id, final Scope scope,
71                                                    final String filter, final List<String> attributes,
72                                                    final List<String> fields,
73                                                    final ClassNameIdGetDataNodeSelectorParameter dataNodeSelector) {
74         return new ResponseEntity<>(new ResourceOneOf("exampleResourceId"), HttpStatus.OK);
75     }
76
77     /**
78      * Patches (Create, Update or Delete) one or multiple resources.
79      *
80      * @param className               Class name of the targeted resource
81      * @param id                      Identifier of the targeted resource
82      * @param resource                Resource representation of the resource to be created or replaced
83      * @return {@code ResponseEntity} The updated resource representations are returned in the response message body.
84      */
85     @Override
86     public ResponseEntity<Resource> classNameidPatch(final String className, final String id, final Resource resource) {
87         return new ResponseEntity<>(resource, HttpStatus.OK);
88     }
89
90     /**
91      * Delete one or multiple resources.
92      *
93      * @param className               Class name of the targeted resource
94      * @param id                      Identifier of the targeted resource
95      * @return {@code ResponseEntity} The response body is empty, HTTP status returned.
96      */
97     @Override
98     public ResponseEntity<Void> classNameidDelete(final String className, final String id) {
99         return new ResponseEntity<>(HttpStatus.OK);
100     }
101 }