use of com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState in project photon-model by vmware.
the class TestGCPEnumerationAtScale method createResourcePoolAndComputeHost.
private void createResourcePoolAndComputeHost() throws Throwable {
// Create a resource pool where the VM will be housed.
this.outPool = createDefaultResourcePool(this.host);
// Create a resource group for the GCP project.
ResourceGroupState resourceGroup = createDefaultResourceGroup(this.host, this.projectID);
// Create a compute host for the GCP VM.
this.computeHost = createDefaultComputeHost(this.host, this.userEmail, this.privateKey, this.zoneID, this.outPool.documentSelfLink, resourceGroup.documentSelfLink);
}
use of com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState in project photon-model by vmware.
the class TestGCPStatsCollection method createResourcePoolAndComputeHostState.
/**
* Creates the state associated with the resource pool and compute host.
* @throws Throwable Exception during creation of default resource pool and compute host.
*/
private void createResourcePoolAndComputeHostState() throws Throwable {
// Create a resource pool where the VM will be housed.
this.outPool = createDefaultResourcePool(this.host);
// Create a resource group for the GCP project.
ResourceGroupState resourceGroup = createDefaultResourceGroup(this.host, this.projectID);
// Create a compute host for the GCP VM.
this.computeHost = createDefaultComputeHost(this.host, this.userEmail, this.privateKey, this.zoneID, this.outPool.documentSelfLink, resourceGroup.documentSelfLink);
}
use of com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState in project photon-model by vmware.
the class VSphereNetworkEnumerationHelper method makeNetworkGroup.
private static ResourceGroupState makeNetworkGroup(NetworkOverlay net, EnumerationProgress ctx) {
ResourceGroupState res = new ResourceGroupState();
res.id = net.getName();
res.name = "Hosts connected to network '" + net.getName() + "'";
res.endpointLink = ctx.getRequest().endpointLink;
AdapterUtils.addToEndpointLinks(res, ctx.getRequest().endpointLink);
res.tenantLinks = ctx.getTenantLinks();
CustomProperties.of(res).put(CustomProperties.MOREF, net.getId()).put(CustomProperties.TARGET_LINK, ctx.getNetworkTracker().getSelfLink(net.getId()));
res.documentSelfLink = VsphereEnumerationHelper.computeGroupStableLink(net.getId(), VSphereIncrementalEnumerationService.PREFIX_NETWORK, ctx.getRequest().endpointLink);
return res;
}
use of com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState in project photon-model by vmware.
the class VsphereDatastoreEnumerationHelper method makeStorageGroup.
private static ResourceGroupState makeStorageGroup(DatastoreOverlay ds, EnumerationProgress ctx) {
ResourceGroupState res = new ResourceGroupState();
res.id = ds.getName();
res.name = "Hosts that can access datastore '" + ds.getName() + "'";
res.endpointLink = ctx.getRequest().endpointLink;
AdapterUtils.addToEndpointLinks(res, ctx.getRequest().endpointLink);
res.tenantLinks = ctx.getTenantLinks();
CustomProperties.of(res).put(CustomProperties.MOREF, ds.getId()).put(CustomProperties.TARGET_LINK, ctx.getDatastoreTracker().getSelfLink(ds.getId()));
res.documentSelfLink = VsphereEnumerationHelper.computeGroupStableLink(ds.getId(), VSphereIncrementalEnumerationService.PREFIX_DATASTORE, ctx.getRequest().endpointLink);
VsphereEnumerationHelper.populateResourceStateWithAdditionalProps(res, ctx.getVcUuid());
return res;
}
use of com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState in project photon-model by vmware.
the class VsphereFolderEnumerationHelper method createFolder.
private static void createFolder(VSphereIncrementalEnumerationService service, EnumerationProgress ctx, FolderOverlay folder, List<FolderOverlay> rootFolders, EnumerationClient client) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
ResourceGroupState state = makeFolderFromResults(ctx, folder, rootFolders, client);
Operation.createPost(PhotonModelUriUtils.createInventoryUri(service.getHost(), ResourceGroupService.FACTORY_LINK)).setBody(state).setCompletion((o, e) -> {
trackFolder(ctx, folder).handle(o, e);
service.logInfo("Creating document for folder with name %s", folder.getName());
}).sendWith(service);
}
Aggregations