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;
20  
21  import java.net.URI;
22  import java.util.NoSuchElementException;
23  import java.util.concurrent.TimeUnit;
24  
25  import javax.annotation.Nullable;
26  
27  import org.jclouds.concurrent.Timeout;
28  import org.jclouds.vcloud.domain.Catalog;
29  import org.jclouds.vcloud.domain.CatalogItem;
30  import org.jclouds.vcloud.domain.Org;
31  import org.jclouds.vcloud.domain.Task;
32  import org.jclouds.vcloud.domain.TasksList;
33  import org.jclouds.vcloud.domain.VDC;
34  import org.jclouds.vcloud.domain.network.OrgNetwork;
35  
36  /**
37   * Provides access to VCloud resources via their REST API.
38   * <p/>
39   * 
40   * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
41   * @author Adrian Cole
42   */
43  @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
44  public interface CommonVCloudClient {
45  
46     Org getOrg(URI orgId);
47  
48     /**
49      * This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within
50      * the organization.
51      * 
52      * @param name
53      *           organization name, or null for the default
54      * @throws NoSuchElementException
55      *            if you specified an org name that isn't present
56      */
57     Org findOrgNamed(@Nullable String name);
58  
59     Catalog getCatalog(URI catalogId);
60  
61     /**
62      * returns the catalog in the organization associated with the specified name. Note that both
63      * parameters can be null to choose default.
64      * 
65      * @param orgName
66      *           organization name, or null for the default
67      * @param catalogName
68      *           catalog name, or null for the default
69      * @throws NoSuchElementException
70      *            if you specified an org or catalog name that isn't present
71      */
72     Catalog findCatalogInOrgNamed(@Nullable String orgName, @Nullable String catalogName);
73  
74     CatalogItem getCatalogItem(URI catalogItem);
75  
76     /**
77      * returns the catalog item in the catalog associated with the specified name. Note that the org
78      * and catalog parameters can be null to choose default.
79      * 
80      * @param orgName
81      *           organization name, or null for the default
82      * @param catalogName
83      *           catalog name, or null for the default
84      * @param itemName
85      *           item you wish to lookup
86      * 
87      * @throws NoSuchElementException
88      *            if you specified an org, catalog, or catalog item name that isn't present
89      */
90     CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName);
91  
92     OrgNetwork findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName);
93  
94     OrgNetwork getNetwork(URI network);
95  
96     VDC getVDC(URI vdc);
97  
98     /**
99      * returns the VDC in the organization associated with the specified name. Note that both
100     * parameters can be null to choose default.
101     * 
102     * @param orgName
103     *           organization name, or null for the default
104     * @param vdcName
105     *           catalog name, or null for the default
106     * @throws NoSuchElementException
107     *            if you specified an org or vdc name that isn't present
108     */
109    VDC findVDCInOrgNamed(String orgName, String vdcName);
110 
111    TasksList getTasksList(URI tasksListId);
112 
113    TasksList findTasksListInOrgNamed(String orgName);
114 
115    /**
116     * Whenever the result of a request cannot be returned immediately, the server creates a Task
117     * object and includes it in the response, as a member of the Tasks container in the response
118     * body. Each Task has an href value, which is a URL that the client can use to retrieve the Task
119     * element alone, without the rest of the response in which it was contained. All information
120     * about the task is included in the Task element when it is returned in the response’s Tasks
121     * container, so a client does not need to make an additional request to the Task URL unless it
122     * wants to follow the progress of a task that was incomplete.
123     */
124    Task getTask(URI taskId);
125 
126    void cancelTask(URI taskId);
127 
128 }