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.compute;
20
21 import java.util.Map;
22
23 import org.jclouds.compute.internal.ComputeServiceContextImpl;
24 import org.jclouds.domain.Credentials;
25 import org.jclouds.rest.RestContext;
26
27 import com.google.common.annotations.Beta;
28 import com.google.inject.ImplementedBy;
29
30 /**
31 * Represents a cloud that has compute functionality.
32 *
33 *
34 * @author Adrian Cole
35 *
36 */
37 @ImplementedBy(ComputeServiceContextImpl.class)
38 public interface ComputeServiceContext {
39
40 ComputeService getComputeService();
41
42 <S, A> RestContext<S, A> getProviderSpecificContext();
43
44 /**
45 * retrieves a list of credentials for resources created within this context, keyed on {@code id}
46 * of the resource with a namespace prefix (ex. {@code node#}. We are testing this approach for
47 * resources such as compute nodes, where you could access this externally.
48 * <p/>
49 * <h4>accessing credentials for a node</h4>
50 * <p/>
51 * the key is in the form {@code node#id}.
52 * <ul>
53 * <li>if the node id is {@code 8}, then the key will be {@code node#8}</li>
54 * <li>if the node id is {@code us-east-1/i-asdfdas}, then the key will be {@code
55 * node#us-east-1/i-asdfdas}</li>
56 * <li>if the node id is {@code http://cloud/instances/1}, then the key will be {@code
57 * node#http://cloud/instances/1}</li>
58 * </ul>
59 */
60 @Beta
61 Map<String, Credentials> getCredentialStore();
62
63 /**
64 * @see ComputeServiceContext#getCredentialStore
65 */
66 @Beta
67 Map<String, Credentials> credentialStore();
68
69 Utils getUtils();
70
71 /**
72 * @see #getUtils
73 */
74 Utils utils();
75
76 void close();
77 }