8542f105a0081129c8f04bfb947aac3012f899f0
[appc.git] / appc-adapters / appc-rest-adapter / appc-rest-adapter-bundle / src / main / java / org / openecomp / appc / adapter / rest / RestAdapter.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.onap.appc.adapter.rest;
26
27 import java.util.Map;
28
29 import org.onap.appc.exceptions.APPCException;
30 import com.att.cdp.zones.model.Server;
31 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
32 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
33
34 /**
35  * This interface defines the operations that the provider adapter exposes.
36  * <p>
37  * This interface defines static constant property values that can be used to configure the adapter. These constants are
38  * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
39  * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
40  * information needed by the adapter to interface with an IaaS provider.
41  * </p>
42  */
43 public interface RestAdapter extends SvcLogicJavaPlugin {
44
45      /**
46      * The type of provider to be accessed to locate and operate on a virtual machine instance. This is used to load the
47      * correct provider support through the CDP IaaS abstraction layer and can be OpenStackProvider, BareMetalProvider,
48      * or any other supported provider type.
49      */
50     static final String PROPERTY_PROVIDER_TYPE = "org.onap.appc.provider.type";
51
52     /**
53      * The adapter maintains a cache of providers organized by the name of the provider, not its type. This is
54      * equivalent to the system or installation name. All regions within the same installation are assumed to be the
55      * same type.
56      */
57     static final String PROPERTY_PROVIDER_NAME = "org.onap.appc.provider.name";
58
59     /**
60      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
61      */
62     static final String PROPERTY_INSTANCE_URL = "org.onap.appc.instance.url";
63
64     /**
65      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
66      */
67     static final String PROPERTY_IDENTITY_URL = "org.onap.appc.identity.url";
68
69     /**
70      * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
71      * <p>
72      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
73      * passed to the method are passed as properties in a map. This method expects the following properties to be
74      * defined:
75      * <dl>
76      * <dt>org.onap.appc.provider.type</dt>
77      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
78      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
79      * provider types are legal.</dd>
80      * <dt>org.onap.appc.instance.url</dt>
81      * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
82      * URL of the server)</dd>
83      * </dl>
84      * </p>
85      * 
86      * @param properties
87      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
88      *            defined above.
89      * @param context
90      *            The service logic context of the graph being executed.
91      * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
92      *         inspected for the final state of the server once the restart has been completed. The method does not
93      *         return until the restart has either completed or has failed.
94      * @throws APPCException
95      *             If the server cannot be restarted for some reason
96      */
97   //  Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
98
99     /**
100      * This method is used to stop the indicated server
101      * <p>
102      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
103      * passed to the method are passed as properties in a map. This method expects the following properties to be
104      * defined:
105      * <dl>
106      * <dt>org.onap.appc.provider.type</dt>
107      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
108      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
109      * provider types are legal.</dd>
110      * <dt>org.onap.appc.instance.url</dt>
111      * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
112      * URL of the server)</dd>
113      * </dl>
114      * </p>
115      * 
116      * @param properties
117      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
118      *            defined above.
119      * @param context
120      *            The service logic context of the graph being executed.
121      * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
122      *         inspected for the final state of the server once the stop has been completed. The method does not return
123      *         until the stop has either completed or has failed.
124      * @throws APPCException
125      *             If the server cannot be stopped for some reason
126      */
127     //Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
128
129     /**
130      * This method is used to start the indicated server
131      * <p>
132      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
133      * passed to the method are passed as properties in a map. This method expects the following properties to be
134      * defined:
135      * <dl>
136      * <dt>org.onap.appc.provider.type</dt>
137      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
138      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
139      * provider types are legal.</dd>
140      * <dt>org.onap.appc.instance.url</dt>
141      * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
142      * URL of the server)</dd>
143      * </dl>
144      * </p>
145      * 
146      * @param properties
147      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
148      *            defined above.
149      * @param context
150      *            The service logic context of the graph being executed.
151      * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
152      *         inspected for the final state of the server once the start has been completed. The method does not return
153      *         until the start has either completed or has failed.
154      * @throws APPCException
155      *             If the server cannot be started for some reason
156      */
157    // Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
158
159     /**
160      * This method is used to rebuild the indicated server
161      * <p>
162      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
163      * passed to the method are passed as properties in a map. This method expects the following properties to be
164      * defined:
165      * <dl>
166      * <dt>org.onap.appc.provider.type</dt>
167      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
168      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
169      * provider types are legal.</dd>
170      * <dt>org.onap.appc.instance.url</dt>
171      * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
172      * URL of the server)</dd>
173      * </dl>
174      * </p>
175      * 
176      * @param properties
177      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
178      *            defined above.
179      * @param context
180      *            The service logic context of the graph being executed.
181      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
182      *         inspected for the final state of the server once the rebuild has been completed. The method does not
183      *         return until the rebuild has either completed or has failed.
184      * @throws APPCException
185      *             If the server cannot be rebuilt for some reason
186      */
187  //   Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
188
189     /**
190      * Returns the symbolic name of the adapter
191      * 
192      * @return The adapter name
193      */
194     String getAdapterName();
195
196    // Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
197
198     //Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
199
200     void commonGet(Map<String, String> params, SvcLogicContext ctx) ;
201     
202     void commonPost(Map<String, String> params, SvcLogicContext ctx) ;
203     
204     void commonPut(Map<String, String> params, SvcLogicContext ctx) ;
205     
206     void commonDelete(Map<String, String> params, SvcLogicContext ctx) ;
207
208 }