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=========================================================
20 package org.openecomp.sdc.be.model.operations.api;
22 import fj.data.Either;
23 import java.util.List;
24 import org.openecomp.sdc.be.resources.data.ConsumerData;
26 public interface IConsumerOperation {
29 * the method updates the node in the graph with the given ConsumerData
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
34 * @return the updated object returned from the graph
36 Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData, boolean inTransaction);
39 * the method updates the node in the graph with the given ConsumerData
41 * @param consumerData the object we want to store
42 * @return the updated object returned from the graph
44 Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData);
47 * the method deletes the node with the given unique id
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
52 * @return the deleted object returned from the graph
54 Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName, boolean inTransaction);
57 * the method deletes the node with the given unique id
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
62 Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName);
65 * the method creates a new nod in the grape representing the supplied credential object
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
71 Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData, boolean inTransaction);
74 * the method creates a new nod in the grape representing the supplied credential object
76 * @param consumerData the object we want to store
77 * @return the newly stored object returned from the graph
79 Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData);
82 * the method retrieves the credential for the given consumer name
84 * @param consumerName the unique id by witch we will look up the credential
85 * @return ConsumerData or the error received during the operation
87 Either<ConsumerData, StorageOperationStatus> getCredentials(String consumerName);
90 * @return all consumers
92 Either<List<ConsumerData>, StorageOperationStatus> getAll();