org.jclouds.vcloud.compute.suppliers.StaticHardwareSupplier Maven / Gradle / Ivy
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC.
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.compute.suppliers;
import java.util.Set;
import javax.inject.Singleton;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.internal.HardwareImpl;
import org.jclouds.compute.domain.internal.VolumeImpl;
import org.jclouds.compute.predicates.ImagePredicates;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
/**
* @author Adrian Cole
*/
@Singleton
public class StaticHardwareSupplier implements Supplier> {
@Override
public Set extends Hardware> get() {
Set sizes = Sets.newHashSet();
for (int cpus : new int[] { 1, 2, 4, 8 })
for (int ram : new int[] { 512, 1024, 2048, 4096, 8192, 16384 }) {
String id = String.format("cpu=%d,ram=%s,disk=%d", cpus, ram, 10);
sizes.add(new HardwareImpl(id, null, id, null, null, ImmutableMap. of(), ImmutableList
.of(new Processor(cpus, 1.0)), ram, ImmutableList.of(new VolumeImpl(10f, true, true)),
ImagePredicates.any()));
}
return sizes;
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy