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 fj.data.Either;
24 import org.openecomp.sdc.be.resources.data.ConsumerData;
26 import java.util.List;
28 public interface IConsumerOperation {
31 * the method updates the node in the graph with the given 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
39 Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData, boolean inTransaction);
42 * the method updates the node in the graph with the given ConsumerData
45 * the object we want to store
46 * @return the updated object returned from the graph
48 Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData);
51 * the method deletes the node with the given unique id
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
59 Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName, boolean inTransaction);
62 * the method deletes the node with the given unique id
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
68 Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName);
71 * the method creates a new nod in the grape representing the supplied credential object
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
79 Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData, boolean inTransaction);
82 * the method creates a new nod in the grape representing the supplied credential object
85 * the object we want to store
86 * @return the newly stored object returned from the graph
88 Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData);
91 * the method retrieves the credential for the given consumer name
94 * the unique id by witch we will look up the credential
95 * @return ConsumerData or the error received during the operation
97 Either<ConsumerData, StorageOperationStatus> getCredentials(String consumerName);
101 * @return all consumers
103 Either<List<ConsumerData>, StorageOperationStatus> getAll();