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