View Javadoc

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.aws.ec2.compute.suppliers;
20  
21  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_medium;
22  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_xlarge;
23  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc1_4xlarge;
24  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large;
25  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small32;
26  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge;
27  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge;
28  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge;
29  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_xlarge;
30  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.t1_micro;
31  
32  import java.util.Set;
33  
34  import javax.inject.Inject;
35  import javax.inject.Singleton;
36  
37  import org.jclouds.aws.ec2.compute.config.ClusterCompute;
38  import org.jclouds.compute.domain.Hardware;
39  import org.jclouds.ec2.compute.suppliers.EC2HardwareSupplier;
40  
41  import com.google.common.collect.ImmutableSet;
42  import com.google.common.collect.ImmutableSet.Builder;
43  
44  /**
45   * 
46   * @author Adrian Cole
47   */
48  @Singleton
49  public class AWSEC2HardwareSupplier extends EC2HardwareSupplier {
50  
51     private final Set<String> ccAmis;
52  
53     @Inject
54     public AWSEC2HardwareSupplier(@ClusterCompute Set<String> ccAmis) {
55        this.ccAmis = ccAmis;
56     }
57  
58     @Override
59     public Set<? extends Hardware> get() {
60        Builder<Hardware> sizes = ImmutableSet.builder();
61        sizes.add(cc1_4xlarge().supportsImageIds(ccAmis).build());
62        sizes.addAll(ImmutableSet.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large()
63                 .build(), m1_small32().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(),
64                 m2_4xlarge().build()));
65        return sizes.build();
66     }
67  }