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