Migrate "ms/controllerblueprints" from ccsdk/apps
[ccsdk/cds.git] / ms / controllerblueprints / modules / blueprint-core / src / main / kotlin / org / onap / ccsdk / apps / controllerblueprints / core / interfaces / BluePrintCatalogService.kt
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
18
19 import org.jetbrains.annotations.NotNull
20 import org.jetbrains.annotations.Nullable
21 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
22 import java.io.File
23 import java.nio.file.Path
24
25 interface BluePrintCatalogService {
26
27     /**
28      * Save the CBA to database.
29      * @param blueprintFile Either a directory, or an archive
30      * @param validate whether to validate blueprint content. Default true.
31      * @return The unique blueprint identifier
32      * @throws BluePrintException if process failed
33      */
34     @NotNull
35     @Throws(BluePrintException::class)
36     fun saveToDatabase(@NotNull blueprintFile: File, @Nullable validate: Boolean = true): String
37
38     /**
39      * Retrieve the CBA from database either archived or extracted.
40      * @param name Name of the blueprint
41      * @param version Version of the blueprint
42      * @param extract true to extract the content, false for archived content. Default to true
43      * @return Path where CBA is located
44      * @throws BluePrintException if process failed
45      */
46     @NotNull
47     @Throws(BluePrintException::class)
48     fun getFromDatabase(@NotNull name: String, @NotNull version: String, @Nullable extract: Boolean = true): Path
49
50     /**
51      * Delete the CBA from database.
52      * @param name Name of the blueprint
53      * @param version Version of the blueprint
54      * @throws BluePrintException if process failed
55      */
56     @NotNull
57     @Throws(BluePrintException::class)
58     fun deleteFromDatabase(@NotNull name: String, @NotNull version: String)
59 }