View Javadoc

1   /**
2    *
3    * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4    *
5    * ====================================================================
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * 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, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   * ====================================================================
18   */
19  package org.jclouds.vcloud.terremark;
20  
21  import java.net.URI;
22  import java.util.Set;
23  import java.util.concurrent.TimeUnit;
24  
25  import javax.annotation.Nullable;
26  
27  import org.jclouds.concurrent.Timeout;
28  import org.jclouds.vcloud.VCloudExpressClient;
29  import org.jclouds.vcloud.domain.Task;
30  import org.jclouds.vcloud.domain.VCloudExpressVApp;
31  import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
32  import org.jclouds.vcloud.terremark.domain.InternetService;
33  import org.jclouds.vcloud.terremark.domain.KeyPair;
34  import org.jclouds.vcloud.terremark.domain.Node;
35  import org.jclouds.vcloud.terremark.domain.Protocol;
36  import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
37  import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem;
38  import org.jclouds.vcloud.terremark.domain.TerremarkOrg;
39  import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
40  import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
41  import org.jclouds.vcloud.terremark.options.AddInternetServiceOptions;
42  import org.jclouds.vcloud.terremark.options.AddNodeOptions;
43  
44  /**
45   * Provides access to VCloud resources via their REST API.
46   * <p/>
47   * 
48   * @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
49   * @author Adrian Cole
50   */
51  @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
52  public interface TerremarkVCloudClient extends VCloudExpressClient {
53     /**
54      * {@inheritDoc}
55      */
56     @Override
57     TerremarkCatalogItem getCatalogItem(URI catalogItem);
58  
59     /**
60      * {@inheritDoc}
61      */
62     @Override
63     TerremarkVDC getVDC(URI catalogItem);
64  
65     /**
66      * {@inheritDoc}
67      */
68     @Override
69     TerremarkCatalogItem findCatalogItemInOrgCatalogNamed(String orgName, String catalogName, String itemName);
70  
71     /**
72      * {@inheritDoc}
73      */
74     @Override
75     TerremarkOrg getOrg(URI orgId);
76  
77     /**
78      * {@inheritDoc}
79      */
80     @Override
81     TerremarkOrg findOrgNamed(String orgName);
82  
83     CustomizationParameters getCustomizationOptions(URI customizationOptions);
84  
85     /**
86      * This call returns a list of public IP addresses.
87      */
88     Set<PublicIpAddress> getPublicIpsAssociatedWithVDC(URI vDCId);
89  
90     void deletePublicIp(URI ipId);
91  
92     /**
93      * This call adds an internet service to a known, existing public IP. This call is identical to
94      * Add Internet Service except you specify the public IP in the request.
95      * 
96      */
97     InternetService addInternetServiceToExistingIp(URI existingIpId, String serviceName, Protocol protocol, int port,
98           AddInternetServiceOptions... options);
99  
100    void deleteInternetService(URI internetServiceId);
101 
102    InternetService getInternetService(URI internetServiceId);
103 
104    Set<InternetService> getAllInternetServicesInVDC(URI vDCId);
105 
106    /**
107     * This call returns information about the internet service on a public IP.
108     */
109    Set<InternetService> getInternetServicesOnPublicIp(URI ipId);
110 
111    Set<InternetService> getPublicIp(URI ipId);
112 
113    /**
114     * This call adds a node to an existing internet service.
115     * <p/>
116     * Every vDC is assigned a network of 60 IP addresses that can be used as nodes. Each node can
117     * associated with multiple internet service. You can get a list of the available IP addresses by
118     * calling Get IP Addresses for a Network.
119     * 
120     * @param internetServiceId
121     * @param ipAddress
122     * @param name
123     * @param port
124     * @param options
125     * @return
126     */
127    Node addNode(URI internetServiceId, String ipAddress, String name, int port, AddNodeOptions... options);
128 
129    Node getNode(URI nodeId);
130 
131    Node configureNode(URI nodeId, String name, boolean enabled, @Nullable String description);
132 
133    void deleteNode(URI nodeId);
134 
135    Set<Node> getNodes(URI internetServiceId);
136 
137    /**
138     * This call configures the settings of an existing vApp by passing the new configuration. The
139     * existing vApp must be in a powered off state (status = 2).
140     * <p/>
141     * You can change the following items for a vApp.
142     * <ol>
143     * <li>vApp name Number of virtual CPUs</li>
144     * <li>Amount of virtual memory</li>
145     * <li>Add a virtual disk</li>
146     * <li>Delete a virtual disk</li>
147     * </ol>
148     * You can make more than one change in a single request. For example, you can increase the
149     * number of virtual CPUs and the amount of virtual memory in the same request.
150     * 
151     * @param VCloudExpressVApp
152     *           vApp to change in power state off
153     * @param configuration
154     *           (s) to change
155     * @return task of configuration change
156     */
157    Task configureVApp(VCloudExpressVApp vApp, VAppConfiguration configuration);
158 
159    /**
160     */
161    Set<KeyPair> listKeyPairsInOrg(URI org);
162 
163    /**
164     * @throws IllegalStateException
165     *            if a key of the same name already exists
166     */
167    KeyPair generateKeyPairInOrg(URI org, String name, boolean makeDefault);
168 
169    /**
170     */
171    KeyPair findKeyPairInOrg(URI org, String keyPairName);
172 
173    KeyPair getKeyPair(URI keyPair);
174 
175    // TODO
176    // KeyPair configureKeyPair(int keyPairId, KeyPairConfiguration
177    // keyPairConfiguration);
178 
179    void deleteKeyPair(URI keyPair);
180 
181 }