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