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