2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.model.operations.api;
23 import org.openecomp.sdc.be.resources.data.ConsumerData;
25 import fj.data.Either;
27 import java.util.List;
29 public interface IConsumerOperation {
32 * the method updates the node in the graph with the given ConsumerData
35 * the object we want to store
36 * @param inTransaction
37 * 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
38 * @return the updated object returned from the graph
40 Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData, boolean inTransaction);
43 * the method updates the node in the graph with the given ConsumerData
46 * the object we want to store
47 * @return the updated object returned from the graph
49 Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData);
52 * the method deletes the node with the given unique id
55 * the unique id by witch we will look up the credential we want to delete
56 * @param inTransaction
57 * 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
58 * @return the deleted object returned from the graph
60 Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName, boolean inTransaction);
63 * the method deletes the node with the given unique id
66 * the unique id by witch we will look up the credential we want to delete
67 * @return the deleted object returned from the graph
69 Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName);
72 * the method creates a new nod in the grape representing the supplied credential object
75 * the object we want to store
76 * @param inTransaction
77 * is the operation part of a transaction, in case the value is false the action will be committed in the end of the method
78 * @return the newly stored object returned from the graph
80 Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData, boolean inTransaction);
83 * the method creates a new nod in the grape representing the supplied credential object
86 * the object we want to store
87 * @return the newly stored object returned from the graph
89 Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData);
92 * the method retrieves the credential for the given consumer name
95 * the unique id by witch we will look up the credential
96 * @return ConsumerData or the error received during the operation
98 Either<ConsumerData, StorageOperationStatus> getCredentials(String consumerName);
102 * @return all consumers
104 Either<List<ConsumerData>, StorageOperationStatus> getAll();