Reformat catalog-model
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / operations / api / IConsumerOperation.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.sdc.be.model.operations.api;
21
22 import fj.data.Either;
23 import java.util.List;
24 import org.openecomp.sdc.be.resources.data.ConsumerData;
25
26 public interface IConsumerOperation {
27
28     /**
29      * the method updates the node in the graph with the given ConsumerData
30      *
31      * @param consumerData  the object we want to store
32      * @param inTransaction inTransaction is the operation part of a transaction, in case the value is false the action will be committed in the end
33      *                      of the method
34      * @return the updated object returned from the graph
35      */
36     Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData, boolean inTransaction);
37
38     /**
39      * the method updates the node in the graph with the given ConsumerData
40      *
41      * @param consumerData the object we want to store
42      * @return the updated object returned from the graph
43      */
44     Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData);
45
46     /**
47      * the method deletes the node with the given unique id
48      *
49      * @param consumerName  the unique id by witch we will look up the credential we want to delete
50      * @param inTransaction inTransaction is the operation part of a transaction, in case the value is false the action will be committed in the end
51      *                      of the method
52      * @return the deleted object returned from the graph
53      */
54     Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName, boolean inTransaction);
55
56     /**
57      * the method deletes the node with the given unique id
58      *
59      * @param consumerName the unique id by witch we will look up the credential we want to delete
60      * @return the deleted object returned from the graph
61      */
62     Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName);
63
64     /**
65      * the method creates a new nod in the grape representing the supplied credential object
66      *
67      * @param consumerData  the object we want to store
68      * @param inTransaction is the operation part of a transaction, in case the value is false the action will be committed in the end of the method
69      * @return the newly stored object returned from the graph
70      */
71     Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData, boolean inTransaction);
72
73     /**
74      * the method creates a new nod in the grape representing the supplied credential object
75      *
76      * @param consumerData the object we want to store
77      * @return the newly stored object returned from the graph
78      */
79     Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData);
80
81     /**
82      * the method retrieves the credential for the given consumer name
83      *
84      * @param consumerName the unique id by witch we will look up the credential
85      * @return ConsumerData or the error received during the operation
86      */
87     Either<ConsumerData, StorageOperationStatus> getCredentials(String consumerName);
88
89     /**
90      * @return all consumers
91      */
92     Either<List<ConsumerData>, StorageOperationStatus> getAll();
93 }