View Javadoc

1   /**
2    * Licensed to jclouds, Inc. (jclouds) under one or more
3    * contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  jclouds licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.jclouds.savvis.vpdc.features;
20  
21  import java.net.URI;
22  import java.util.Set;
23  import java.util.concurrent.TimeUnit;
24  
25  import org.jclouds.concurrent.Timeout;
26  import org.jclouds.savvis.vpdc.domain.Task;
27  import org.jclouds.savvis.vpdc.domain.VMSpec;
28  
29  /**
30   * Provides access to Symphony VPDC resources via their REST API.
31   * <p/>
32   * 
33   * @see <a href="https://api.sandbox.symphonyvpdc.savvis.net/doc/spec/api/" />
34   * @author Adrian Cole
35   */
36  @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
37  public interface VMClient {
38  
39     /**
40      * Add/Deploy new VM into VDC
41      * 
42      * @param billingSiteId
43      *           billing site Id, or null for default
44      * @param vpdcId
45      *           vpdc Id
46      * @param spec
47      *           how to
48      * 
49      * @return VM in progress
50      */
51     Task addVMIntoVDC(String billingSiteId, String vpdcId, VMSpec spec);
52  
53     /**
54      * 
55      * @param vpdc
56      *           href of the vpdc
57      * @see #addVMIntoVDC
58      */
59     Task addVMIntoVDC(URI vpdc, VMSpec spec);
60  
61     /**
62      * Add/Deploy new VMs into VDC
63      * 
64      * @param billingSiteId
65      *           billing site Id, or null for default
66      * @param vpdcId
67      *           vpdc Id
68      * @param vmSpecs
69      *           vm configurations
70      * @return VM's in progress
71      */
72     Set<Task> addMultipleVMsIntoVDC(String billingSiteId, String vpdcId, Iterable<VMSpec> vmSpecs);
73  
74     /**
75      * Add/Deploy new VMs into VDC
76      * 
77      * @param vpdc
78      *           href of the vpdc
79      * @param vmSpecs
80      *           vm configurations
81      * @return VM's in progress
82      */
83     Set<Task> addMultipleVMsIntoVDC(URI vpdc, Iterable<VMSpec> vmSpecs);
84  
85     /**
86      * 
87      * @param billingSiteId
88      *           billing site Id, or null for default
89      * @param vpdcId
90      *           vpdc Id
91      * @param vAppUri
92      *           href of the vApp
93      * @return Task with vAppTemplate href
94      */
95     Task captureVApp(String billingSiteId, String vpdcId, URI vAppUri);
96  
97     /**
98      * 
99      * @param vAppUri
100     *           href of the vApp
101     * @param newVAppName
102     *           name for the new vApp
103     * @param networkTierName
104     *           network tier name for vApp
105     * @return
106     */
107    Task cloneVApp(URI vAppUri, String newVAppName, String networkTierName);
108 
109    /**
110     * Remove a VM
111     * <p/>
112     * <h4>Pre-conditions:</h4>
113     * 
114     * <ul>
115     * <li>No snapshot has been created for the VM.</li>
116     * <li>For Balanced profile, the VM must not be associated with any firewall rule and/or included
117     * in a load balancing pool.</li>
118     * </ul>
119     * 
120     * @param billingSiteId
121     *           billing site Id, or null for default
122     * @param vpdcId
123     *           vpdc Id
124     * @param vmId
125     *           vm you wish to remove
126     * @return null, if the vm was not found
127     */
128    Task removeVMFromVDC(String billingSiteId, String vpdcId, String vmId);
129 
130    /**
131     * 
132     * Remove a VM
133     * 
134     * @param vm
135     *           href of the vm
136     * @see #removeVMFromVDC
137     */
138    Task removeVM(URI vm);
139 
140    /**
141     * Power off a VM
142     * 
143     * @param vm
144     *           href of the vm
145     * @return
146     */
147    Task powerOffVM(URI vm);
148 
149    /**
150     * Power on a VM
151     * 
152     * @param vm
153     *           href of the vm
154     * @return
155     */
156    Task powerOnVM(URI vm);
157 }