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.cloudloadbalancers.features;
20
21 import java.util.Set;
22 import java.util.concurrent.TimeUnit;
23
24 import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
25 import org.jclouds.cloudloadbalancers.domain.LoadBalancerAttributes;
26 import org.jclouds.cloudloadbalancers.domain.LoadBalancerRequest;
27 import org.jclouds.concurrent.Timeout;
28 import org.jclouds.http.HttpResponseException;
29
30 /**
31 * Provides synchronous access to CloudLoadBalancers LoadBalancer features.
32 * <p/>
33 *
34 * @see LoadBalancerAsyncClient
35 * @see <a
36 * href="http://docs.rackspacecloud.com/loadbalancers/api/v1.0/clb-devguide/content/ch04s01.html"
37 * />
38 * @author Adrian Cole
39 */
40 @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
41 public interface LoadBalancerClient {
42 /**
43 * Create a new load balancer with the configuration defined by the request.
44 *
45 * <p/>
46 * This operation asynchronously provisions a new load balancer based on the configuration
47 * defined in the request object. Once the request is validated and progress has started on the
48 * provisioning process, a response object will be returned.
49 *
50 *
51 * @param lb
52 * configuration to create
53 * @return The object will contain a unique identifier and status of the request. Using the
54 * identifier, the caller can check on the progress of the operation by performing a
55 * {@link LoadBalancerClient#getLoadBalancer}.
56 * @throws HttpResponseException
57 * If the corresponding request cannot be fulfilled due to insufficient or invalid
58 * data
59 *
60 */
61 LoadBalancer createLoadBalancer(LoadBalancerRequest lb);
62
63 /**
64 *
65 * Update the properties of a load balancer.
66 *
67 * <p/>
68 * This operation asynchronously updates the attributes of the specified load balancer. Upon
69 * successful validation of the request, the service will return a 202 (Accepted) response code.
70 * A caller can poll the load balancer with its ID to wait for the changes to be applied and the
71 * load balancer to return to an ACTIVE status.
72 *
73 * @param id
74 * id of the loadbalancer to change
75 * @param attrs
76 * what to change
77 * @return The object will contain a unique identifier and status of the request. Using the
78 * identifier, the caller can check on the progress of the operation by performing a
79 * {@link LoadBalancerClient#getLoadBalancer}.
80 * @see LoadBalancerAttributes#fromLoadBalancer
81 */
82 void updateLoadBalancerAttributes(int id, LoadBalancerAttributes attrs);
83
84 /**
85 *
86 * @return all load balancers configured for the account, or empty set if none available
87 */
88 Set<LoadBalancer> listLoadBalancers();
89
90 /**
91 *
92 *
93 * @param id
94 * id of the loadbalancer to retrieve
95 * @return details of the specified load balancer, or null if not found
96 */
97 LoadBalancer getLoadBalancer(int id);
98
99 /**
100 * Remove a load balancer from the account.
101 * <p/>
102 * The remove load balancer function removes the specified load balancer and its associated
103 * configuration from the account. Any and all configuration data is immediately purged and is
104 * not recoverable.
105 *
106 * @param id
107 * to remove
108 */
109 void removeLoadBalancer(int id);
110 }