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.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 }