Search in sources :

Example 1 with TaskOption

use of com.vmware.photon.controller.model.tasks.TaskOption in project photon-model by vmware.

the class TestAWSSetupUtils method performResourceStatsCollection.

/**
 * Performs stats collection for given resourcePoolLink
 */
public static StatsCollectionTaskState performResourceStatsCollection(VerificationHost host, EnumSet<TaskOption> options, String resourcePoolLink) throws Throwable {
    StatsCollectionTaskState statsCollectionTaskState = new StatsCollectionTaskState();
    statsCollectionTaskState.resourcePoolLink = resourcePoolLink;
    statsCollectionTaskState.options = EnumSet.noneOf(TaskOption.class);
    if (options != null) {
        statsCollectionTaskState.options = options;
    }
    URI uri = UriUtils.buildUri(host, StatsCollectionTaskService.FACTORY_LINK);
    StatsCollectionTaskState statsTask = TestUtils.doPost(host, statsCollectionTaskState, StatsCollectionTaskState.class, uri);
    return statsTask;
}
Also used : TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) URI(java.net.URI) ProvisioningUtils.createServiceURI(com.vmware.photon.controller.model.tasks.ProvisioningUtils.createServiceURI) StatsCollectionTaskState(com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService.StatsCollectionTaskState)

Example 2 with TaskOption

use of com.vmware.photon.controller.model.tasks.TaskOption in project photon-model by vmware.

the class AzureTestUtil method performResourceStatsCollection.

/**
 * Performs stats collection for given resourcePoolLink.
 */
public static StatsCollectionTaskState performResourceStatsCollection(VerificationHost host, EnumSet<TaskOption> options, String resourcePoolLink) throws Throwable {
    StatsCollectionTaskState statsCollectionTaskState = new StatsCollectionTaskState();
    statsCollectionTaskState.resourcePoolLink = resourcePoolLink;
    statsCollectionTaskState.options = EnumSet.noneOf(TaskOption.class);
    if (options != null) {
        statsCollectionTaskState.options = options;
    }
    URI uri = UriUtils.buildUri(host, StatsCollectionTaskService.FACTORY_LINK);
    StatsCollectionTaskState statsTask = TestUtils.doPost(host, statsCollectionTaskState, StatsCollectionTaskState.class, uri);
    return statsTask;
}
Also used : TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) URI(java.net.URI) StatsCollectionTaskState(com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService.StatsCollectionTaskState)

Example 3 with TaskOption

use of com.vmware.photon.controller.model.tasks.TaskOption in project photon-model by vmware.

the class TestAWSSetupUtils method performResourceEnumeration.

/**
 * Method to perform compute resource enumeration on the AWS endpoint.
 *
 * @param resourcePoolLink
 *            The link to the AWS resource pool.
 * @param computeDescriptionLink
 *            The link to the compute description for the AWS host.
 * @param parentComputeLink
 *            The compute state associated with the AWS host.
 * @return
 * @throws Throwable
 */
public static ResourceEnumerationTaskState performResourceEnumeration(VerificationHost host, ComputeState computeHost, EndpointState endpointState, URI peerURI, EnumSet<TaskOption> options) throws Throwable {
    // Kick of a Resource Enumeration task to enumerate the instances on the AWS endpoint
    ResourceEnumerationTaskState enumerationTaskState = new ResourceEnumerationTaskState();
    enumerationTaskState.parentComputeLink = computeHost.documentSelfLink;
    enumerationTaskState.enumerationAction = EnumerationAction.START;
    enumerationTaskState.adapterManagementReference = UriUtils.buildUri(AWSEnumerationAdapterService.SELF_LINK);
    enumerationTaskState.resourcePoolLink = computeHost.resourcePoolLink;
    if (options != null) {
        enumerationTaskState.options = options;
    } else {
        enumerationTaskState.options = EnumSet.noneOf(TaskOption.class);
    }
    enumerationTaskState.tenantLinks = endpointState.tenantLinks;
    enumerationTaskState.endpointLink = endpointState.documentSelfLink;
    URI uri = createServiceURI(host, peerURI, ResourceEnumerationTaskService.FACTORY_LINK);
    return TestUtils.doPost(host, enumerationTaskState, ResourceEnumerationTaskState.class, uri);
}
Also used : ResourceEnumerationTaskState(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService.ResourceEnumerationTaskState) TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) URI(java.net.URI) ProvisioningUtils.createServiceURI(com.vmware.photon.controller.model.tasks.ProvisioningUtils.createServiceURI)

Aggregations

TaskOption (com.vmware.photon.controller.model.tasks.TaskOption)3 URI (java.net.URI)3 ProvisioningUtils.createServiceURI (com.vmware.photon.controller.model.tasks.ProvisioningUtils.createServiceURI)2 StatsCollectionTaskState (com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService.StatsCollectionTaskState)2 ResourceEnumerationTaskState (com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService.ResourceEnumerationTaskState)1