Tabnine Logo
OfferingApi
Code IndexAdd Tabnine to your IDE (free)

How to use
OfferingApi
in
org.jclouds.cloudstack.features

Best Java code snippets using org.jclouds.cloudstack.features.OfferingApi (Showing top 13 results out of 315)

origin: apache/jclouds

@Override
public Iterable<ServiceOffering> listHardwareProfiles() {
 // TODO: we may need to filter these
 return client.getOfferingApi().listServiceOfferings();
}
origin: apache/jclouds

protected DiskOffering getPreferredDiskOffering() {
 for (DiskOffering candidate : client.getOfferingApi().listDiskOfferings()) {
   //any will do
   return candidate;
 }
 throw new AssertionError("No suitable DiskOffering found.");
}
protected Snapshot getPreferredSnapshot() {
origin: apache/jclouds

public void testListDiskOfferings() throws Exception {
 Set<DiskOffering> response = client.getOfferingApi().listDiskOfferings();
 assert null != response;
 long offeringCount = response.size();
 assertTrue(offeringCount >= 0);
 for (DiskOffering offering : response) {
   try {
    DiskOffering newDetails = Iterables.getOnlyElement(client.getOfferingApi().listDiskOfferings(
      ListDiskOfferingsOptions.Builder.id(offering.getId())));
    assertEquals(offering, newDetails);
    assertEquals(offering, client.getOfferingApi().getDiskOffering(offering.getId()));
    assert offering.getId() != null : offering;
    assert offering.getName() != null : offering;
    assert offering.getCreated() != null : offering;
    assert offering.getDisplayText() != null : offering;
    assert offering.getDiskSize() > 0 || (offering.getDiskSize() == 0 && offering.isCustomized()) : offering;
    assert offering.getTags() != null : offering;
   } catch (NoSuchElementException e) {
    // This bug is present both in 2.2.8 and 2.2.12
    assertTrue(Predicates.in(ImmutableSet.of("2.2.8", "2.2.12")).apply(apiVersion));
   }
 }
}
origin: apache/jclouds

  public void testListNetworkOfferings() throws Exception {
   Set<NetworkOffering> response = client.getOfferingApi().listNetworkOfferings();
   assert null != response;
   long offeringCount = response.size();
   assertTrue(offeringCount >= 0);
   for (NetworkOffering offering : response) {
     NetworkOffering newDetails = Iterables.getOnlyElement(client.getOfferingApi().listNetworkOfferings(
        ListNetworkOfferingsOptions.Builder.id(offering.getId())));
     assertEquals(offering, newDetails);
     assertEquals(offering, client.getOfferingApi().getNetworkOffering(offering.getId()));
     assert offering.getId() != null : offering;
     assert offering.getName() != null : offering;
     assert offering.getDisplayText() != null : offering;
     assert offering.getMaxConnections() == null || offering.getMaxConnections() > 0 : offering;
     assert offering.getTrafficType() != null && TrafficType.UNRECOGNIZED != offering.getTrafficType() : offering;
     assert offering.getTags() != null : offering;
   }
  }
}
origin: apache/jclouds

@Test
public void testCreateGuestVirtualNetwork() {
 if (!networksSupported)
   return;
 final NetworkOffering offering;
 try {
   offering = find(client.getOfferingApi().listNetworkOfferings(),
      NetworkOfferingPredicates.supportsGuestVirtualNetworks());
 } catch (NoSuchElementException e) {
   Logger.getAnonymousLogger().log(Level.SEVERE, "guest networks not supported, skipping test");
   return;
 }
 String name = prefix + "-virtual";
 Network network = null;
 try {
   network = client.getNetworkApi().createNetworkInZone(zone.getId(), offering.getId(), name, name);
   checkNetwork(network);
 } catch (IllegalStateException e) {
   Logger.getAnonymousLogger().log(Level.SEVERE, "couldn't create a network, skipping test", e);
 } finally {
   if (network != null) {
    String jobId = client.getNetworkApi().deleteNetwork(network.getId());
    if (jobId != null)
      jobComplete.apply(jobId);
   }
 }
}
origin: apache/jclouds

try {
  offering = get(
     cloudStackContext.getApi().getOfferingApi().listNetworkOfferings(specifyVLAN(true).zoneId(zone.getId())), 0);
} catch (NoSuchElementException e) {
  Logger.getAnonymousLogger().log(Level.SEVERE, "VLAN networks not supported, skipping test");
origin: apache/jclouds

public void testListServiceOfferings() throws Exception {
 Set<ServiceOffering> response = client.getOfferingApi().listServiceOfferings();
 assert null != response;
 long offeringCount = response.size();
 assertTrue(offeringCount >= 0);
 for (ServiceOffering offering : response) {
   ServiceOffering newDetails = Iterables.getOnlyElement(client.getOfferingApi().listServiceOfferings(
      ListServiceOfferingsOptions.Builder.id(offering.getId())));
   assertEquals(offering, newDetails);
   assert offering.getId() != null : offering;
   assert offering.getName() != null : offering;
   assert offering.getDisplayText() != null : offering;
   assert offering.getCpuNumber() > 0 : offering;
   assert offering.getCpuSpeed() > 0 : offering;
   assert offering.getMemory() > 0 : offering;
   assert offering.getStorageType() != null && StorageType.UNRECOGNIZED != offering.getStorageType() : offering;
   assert offering.getTags() != null : offering;
 }
}
origin: apache/jclouds

cloudStackContext.getApi().getOfferingApi().listNetworkOfferings(specifyVLAN(true).zoneId(zoneId)), 0).getId();
origin: apache/jclouds

protected DiskOffering getPreferredDiskOffering() {
 for (DiskOffering candidate : client.getOfferingApi().listDiskOfferings()) {
   if (!candidate.isCustomized()) {
    return candidate;
   }
 }
 throw new AssertionError("No suitable DiskOffering found.");
}
origin: apache/jclouds

public static VirtualMachine createVirtualMachineWithOptionsInZone(DeployVirtualMachineOptions options, String zoneId,
   String templateId, CloudStackApi client, Predicate<String> jobComplete,
   Predicate<VirtualMachine> virtualMachineRunning) {
 String serviceOfferingId = DEFAULT_SIZE_ORDERING.min(client.getOfferingApi().listServiceOfferings()).getId();
 System.out.printf("serviceOfferingId %s, templateId %s, zoneId %s, options %s%n", serviceOfferingId, templateId,
    zoneId, options);
 AsyncCreateResponse job = client.getVirtualMachineApi().deployVirtualMachineInZone(zoneId, serviceOfferingId,
    templateId, options);
 assertTrue(jobComplete.apply(job.getJobId()));
 AsyncJob<VirtualMachine> jobWithResult = client.getAsyncJobApi().<VirtualMachine> getAsyncJob(job.getJobId());
 if (jobWithResult.getError() != null)
   Throwables.propagate(new ExecutionException(String.format("job %s failed with exception %s", job.getId(),
      jobWithResult.getError().toString())) {
   });
 VirtualMachine vm = jobWithResult.getResult();
 if (vm.isPasswordEnabled()) {
   assert vm.getPassword() != null : vm;
 }
 assertTrue(virtualMachineRunning.apply(vm));
 assertEquals(vm.getServiceOfferingId(), serviceOfferingId);
 assertEquals(vm.getTemplateId(), templateId);
 assertEquals(vm.getZoneId(), zoneId);
 return vm;
}
origin: apache/jclouds

 client.getOfferingApi().listNetworkOfferings(
   ListNetworkOfferingsOptions.Builder.zoneId(template.getZoneId()).specifyVLAN(true)), null);
checkNotNull(offering, "No network offering found");
origin: apache/jclouds

/** Test requires a custom disk offering to be available */
public void testCreateVolumeFromCustomDiskOffering() {
 final int size = 1;
 DiskOffering offering = null;
 for (DiskOffering candidate : client.getOfferingApi().listDiskOfferings()) {
   if (candidate.isCustomized()) {
    offering = candidate;
    break;
   }
 }
 
 assertNotNull("No custom disk offering found!", offering);
 
 AsyncCreateResponse job = client.getVolumeApi().createVolumeFromCustomDiskOfferingInZone(
      prefix + "-jclouds-volume", offering.getId(), zoneId, size);
 assertTrue(jobComplete.apply(job.getJobId()));
 logger.info("created volume " + job.getId());
 
 Volume volume = findVolumeWithId(job.getId());
 try {
   checkVolume(volume);
   assertEquals(volume.getSize(), size * 1024 * 1024 * 1024);
 } finally {
   client.getVolumeApi().deleteVolume(volume.getId());
 }
}
origin: apache/jclouds

final NetworkOffering offering = Iterables.tryFind(client.getOfferingApi().listNetworkOfferings(),
                          NetworkOfferingPredicates.supportsGuestVirtualNetworks()).orNull();
org.jclouds.cloudstack.featuresOfferingApi

Javadoc

Provides synchronous access to cloudstack via their REST API.

Most used methods

  • listServiceOfferings
    Lists service offerings
  • getDiskOffering
    get a specific disk offering by id
  • getNetworkOffering
    get a specific service offering by id
  • listDiskOfferings
    Lists disk offerings
  • listNetworkOfferings
    Lists service offerings

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now