re base code
[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
21 package org.openecomp.sdc.be.model.operations.api;
22
23 import fj.data.Either;
24 import org.openecomp.sdc.be.resources.data.ConsumerData;
25
26 import java.util.List;
27
28 public interface IConsumerOperation {
29
30     /**
31      * the method updates the node in the graph with the given ConsumerData
32      *
33      * @param consumerData
34      *            the object we want to store
35      * @param inTransaction
36      *            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
37      * @return the updated object returned from the graph
38      */
39     Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData, boolean inTransaction);
40
41     /**
42      * the method updates the node in the graph with the given ConsumerData
43      *
44      * @param consumerData
45      *            the object we want to store
46      * @return the updated object returned from the graph
47      */
48     Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData);
49
50     /**
51      * the method deletes the node with the given unique id
52      *
53      * @param consumerName
54      *            the unique id by witch we will look up the credential we want to delete
55      * @param inTransaction
56      *            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
57      * @return the deleted object returned from the graph
58      */
59     Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName, boolean inTransaction);
60
61     /**
62      * the method deletes the node with the given unique id
63      *
64      * @param consumerName
65      *            the unique id by witch we will look up the credential we want to delete
66      * @return the deleted object returned from the graph
67      */
68     Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName);
69
70     /**
71      * the method creates a new nod in the grape representing the supplied credential object
72      *
73      * @param consumerData
74      *            the object we want to store
75      * @param inTransaction
76      *            is the operation part of a transaction, in case the value is false the action will be committed in the end of the method
77      * @return the newly stored object returned from the graph
78      */
79     Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData, boolean inTransaction);
80
81     /**
82      * the method creates a new nod in the grape representing the supplied credential object
83      *
84      * @param consumerData
85      *            the object we want to store
86      * @return the newly stored object returned from the graph
87      */
88     Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData);
89
90     /**
91      * the method retrieves the credential for the given consumer name
92      *
93      * @param consumerName
94      *            the unique id by witch we will look up the credential
95      * @return ConsumerData or the error received during the operation
96      */
97     Either<ConsumerData, StorageOperationStatus> getCredentials(String consumerName);
98
99     /**
100      *
101      * @return all consumers
102      */
103     Either<List<ConsumerData>, StorageOperationStatus> getAll();
104
105 }