Onboarding upload control
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vendor-software-products-rest-services / src / main / java / org / openecomp / sdcrests / vsp / rest / services / OrchestrationTemplateCandidateUploadManager.java
1 /*
2  * -
3  *  ============LICENSE_START=======================================================
4  *  Copyright (C) 2022 Nordix Foundation.
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  *  SPDX-License-Identifier: Apache-2.0
19  *  ============LICENSE_END=========================================================
20  */
21
22 package org.openecomp.sdcrests.vsp.rest.services;
23
24 import java.util.Optional;
25 import java.util.UUID;
26 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspUploadStatus;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspUploadStatusDto;
28
29 public interface OrchestrationTemplateCandidateUploadManager {
30
31     /**
32      * Creates a lock to start uploading a package.
33      *
34      * @param vspId        the Vendor Software Product id
35      * @param vspVersionId the Vendor Software Product version id
36      * @param user         the current user
37      * @return a new upload status containing the lock
38      */
39     VspUploadStatusDto putUploadInProgress(String vspId, String vspVersionId, String user);
40
41     /**
42      * Finishes the upload process, applying the given VspUploadStatusType completion status.
43      *
44      * @param vspId            the Vendor Software Product id
45      * @param vspVersionId     the Vendor Software Product version id
46      * @param lockId           the upload lock id
47      * @param completionStatus any status that represents a completion
48      * @param user             the current user
49      * @return the updated status
50      */
51     VspUploadStatusDto putUploadAsFinished(final String vspId, final String vspVersionId, final UUID lockId, final VspUploadStatus completionStatus,
52                                            final String user);
53
54     /**
55      * Finds the latest upload status for a given Vendor Software Product version.
56      *
57      * @param vspId        the Vendor Software Product id
58      * @param vspVersionId the Vendor Software Product version id
59      * @param user         the current user
60      * @return the latest upload status for the requested Vendor Software Product version
61      */
62     Optional<VspUploadStatusDto> findLatestStatus(String vspId, String vspVersionId, String user);
63 }