aboutsummaryrefslogtreecommitdiffstats
path: root/ccsdk-app-common/src/main/java/org/onap/ccsdk/dashboard/rest/InventoryClient.java
blob: d9f03adbdb201cd65e34641cc17061faa77f8721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package org.onap.ccsdk.dashboard.rest;

import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;

import org.onap.ccsdk.dashboard.exceptions.inventory.ServiceAlreadyDeactivatedException;
import org.onap.ccsdk.dashboard.exceptions.inventory.ServiceNotFoundException;
import org.onap.ccsdk.dashboard.exceptions.inventory.ServiceTypeActiveException;
import org.onap.ccsdk.dashboard.exceptions.inventory.ServiceTypeAlreadyDeactivatedException;
import org.onap.ccsdk.dashboard.exceptions.inventory.ServiceTypeNotFoundException;
import org.onap.ccsdk.dashboard.model.inventory.InventoryProperty;
import org.onap.ccsdk.dashboard.model.inventory.Service;
import org.onap.ccsdk.dashboard.model.inventory.ServiceQueryParams;
import org.onap.ccsdk.dashboard.model.inventory.ServiceRefList;
import org.onap.ccsdk.dashboard.model.inventory.ServiceType;
import org.onap.ccsdk.dashboard.model.inventory.ServiceTypeQueryParams;
import org.onap.ccsdk.dashboard.model.inventory.ServiceTypeRequest;

/**
 * Defines the interface of the Inventory Client.
 */
public interface InventoryClient {

	/**
	 * Gets a list of all DCAE Service Type objects.
	 * 
	 * @return Collection<ServiceType>
	 */
	public Stream<ServiceType> getServiceTypes();
	
	/**
	 * Gets a list of all DCAE Service Type objects that fall under a specified filter.
	 * 
	 * @param serviceTypeQueryParams
	 * 		ServiceTypeQueryParams object containing query parameters.
	 * 
	 * @return Collection<ServiceType>
	 */
	public Stream<ServiceType> getServiceTypes(ServiceTypeQueryParams serviceTypeQueryParams);
	
	/**
	 * Inserts a new DCAE Service Type, or updates an existing instance associated with the name typeName.
	 * Updates are only allowed iff there are no running DCAE services of the requested type.
	 * 
	 * @param serviceType
	 * 			Service Type to be uploaded.
	 * 
	 * @return ServiceType
	 * 
	 * @throws ServiceTypeActiveException if the service type exists and has active instances
	 */
	public ServiceType addServiceType(ServiceType serviceType) throws ServiceTypeActiveException;
	
	/**
	 * Inserts a new DCAE Service Type, or updates an existing instance associated with the name typeName.
	 * Updates are only allowed iff there are no running DCAE services of the requested type.
	 * 
	 * @param serviceType
	 * 			Service Type to be uploaded.
	 * @return 
	 * 
	 * @throws ServiceTypeActiveException if the service type exists and has active instances
	 */
	public ServiceType addServiceType(ServiceTypeRequest serviceTypeRequest) throws ServiceTypeActiveException;
	
	/**
	 * Gets a single DCAE Service Type object with the ID typeId.
	 * 
	 * @param typeId
	 * 			ID of the DCAE Service Type to be retrieved.
	 * 
	 * @return Optional<ServiceType>
	 */
	public Optional<ServiceType> getServiceType(String typeId);
	
	/**
	 * Deactivates an existing DCAE Service Type instance with the ID typeId.
	 * 
	 * @param typeId
	 * 			ID of the DCAE Service Type to be deactivated.
	 * 
	 * @exception ServiceTypeNotFoundException
	 * 			Thrown if the DCAE Service Type is not found.
	 * 
	 * @exception ServiceTypeAlreadyDeactivatedException
	 * 			Thrown if the DCAE Service Type is already deactivated.
	 */
	public void deleteServiceType(String typeId) throws ServiceTypeNotFoundException, ServiceTypeAlreadyDeactivatedException;
	
	/**
	 * Gets a list of all DCAE Service objects.
	 * 
	 * @return Collection<Service>
	 */
	public Stream<Service> getServices();
	
	/**
	 * Gets a list of all DCAE Service objects that fall under a specified filter.
	 * 
	 * @param serviceQueryParams
	 * 			ServiceQueryParams object containing query parameters.
	 * 
	 * @return Collection<Service>
	 */
	public Stream<Service> getServices(ServiceQueryParams serviceQueryParams);
	
	/**
	 * Gets a list of all DCAE Service References that match a service type filter.
	 * 
	 * @param serviceQueryParams
	 * 			ServiceQueryParams object containing query parameters.
	 * 
	 * @return ServiceRefList
	 */
	public ServiceRefList getServicesForType(ServiceQueryParams serviceQueryParams);
	
	/**
	 * Gets a set of properties on Service objects that match the provided propertyName
	 * 
	 * @param propertyName
	 * 			Property to find unique values. Restricted to type, vnfType, vnfLocation.
	 * 
	 * @return Set<InventoryProperty>
	 */
	
	public Set<InventoryProperty> getPropertiesOfServices(String propertyName);
	
	/**
	 * Gets a single DCAE Service object corresponding to the specified serviceId.
	 * 
	 * @param serviceId
	 * 			Service ID of the DCAE Service to be retrieved.
	 * 
	 * @return Service
	 */
	
	public Optional<Service> getService(String serviceId);
	
	/**
	 * Puts a new DCAE Service with the specified serviceId, or updates an existing DCAE Service corresponding to the specified serviceId.
	 * 
	 * @param typeId
	 * 			Type ID of the associated DCAE Service Type
	 * 
	 * @param service
	 * 			DCAE Service to be uploaded.
	 */
	public void putService(String typeId, Service service);

	/**
	 * Deletes an existing DCAE Service object corresponding to the specified serviceId.
	 * 
	 * @param serviceId
	 * 			Service ID of the DCAE Service to be deleted.
	 * 
	 * @exception ServiceNotFoundException
	 * 			Thrown if the DCAE Service is not found.
	 * 
	 * @exception ServiceAlreadyDeactivatedException
	 * 			Thrown if the DCAE Service is already deactivated.
	 * 
	 */
	
	public void deleteService(String serviceId) throws ServiceNotFoundException, ServiceAlreadyDeactivatedException;

}