Search in sources :

Example 71 with ComputeDescription

use of com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription in project photon-model by vmware.

the class QueryUtilsTest method testQueryReferrers_noResults.

@Test
public void testQueryReferrers_noResults() throws Throwable {
    ComputeDescription cd = ModelUtils.createComputeDescription(this, null, null);
    Set<String> expected = Collections.emptySet();
    doTest(cd, expected, Collections.singletonList("http://tenant"));
}
Also used : ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) BaseModelTest(com.vmware.photon.controller.model.helpers.BaseModelTest) Test(org.junit.Test)

Example 72 with ComputeDescription

use of com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription in project photon-model by vmware.

the class QueryUtilsTest method testQueryReferrers_error.

@Test
public void testQueryReferrers_error() throws Throwable {
    ComputeDescription cd = ModelUtils.createComputeDescription(this, null, null);
    ModelUtils.createCompute(this, cd);
    ModelUtils.createCompute(this, cd);
    Query queryForReferrers = QueryUtils.queryForReferrers(cd.documentSelfLink, ComputeState.class, ComputeState.FIELD_NAME_DESCRIPTION_LINK);
    // The class under testing
    QueryStrategy<ComputeState> queryStrategy = new QueryByPages<>(getHost(), queryForReferrers, ComputeState.class, Collections.emptyList(), null);
    Set<String> actual = new HashSet<>();
    // The method under testing
    waitToComplete(queryStrategy.queryDocuments(cs -> {
        if (actual.isEmpty()) {
            actual.add(cs.documentSelfLink);
        } else {
            throw new RuntimeException("consume error");
        }
    }).handle((v, e) -> {
        // Validate processed docs
        assertThat(actual.size(), equalTo(1));
        // Validate exception propagation
        assertThat(e, notNullValue());
        assertThat(e, instanceOf(CompletionException.class));
        assertThat(e.getCause().getMessage(), equalTo("consume error"));
        // Recover from exception to prevent its propagation to outer test method
        return (Void) null;
    }));
}
Also used : Arrays(java.util.Arrays) ModelUtils(com.vmware.photon.controller.model.ModelUtils) BaseModelTest(com.vmware.photon.controller.model.helpers.BaseModelTest) QueryByPages(com.vmware.photon.controller.model.query.QueryUtils.QueryByPages) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Set(java.util.Set) CompletionException(java.util.concurrent.CompletionException) Test(org.junit.Test) QueryTop(com.vmware.photon.controller.model.query.QueryUtils.QueryTop) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) HashSet(java.util.HashSet) List(java.util.List) Query(com.vmware.xenon.services.common.QueryTask.Query) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) Collectors.mapping(java.util.stream.Collectors.mapping) Matchers.equalTo(org.hamcrest.Matchers.equalTo) QueryTemplate(com.vmware.photon.controller.model.query.QueryUtils.QueryTemplate) DeferredResult(com.vmware.xenon.common.DeferredResult) PhotonModelUtils.waitToComplete(com.vmware.photon.controller.model.resources.util.PhotonModelUtils.waitToComplete) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Collections(java.util.Collections) Collectors.toSet(java.util.stream.Collectors.toSet) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) QueryByPages(com.vmware.photon.controller.model.query.QueryUtils.QueryByPages) Query(com.vmware.xenon.services.common.QueryTask.Query) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) HashSet(java.util.HashSet) BaseModelTest(com.vmware.photon.controller.model.helpers.BaseModelTest) Test(org.junit.Test)

Example 73 with ComputeDescription

use of com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription in project photon-model by vmware.

the class TestAWSSetupUtils method createAWSComputeHost.

/**
 * Create a compute host description for an AWS instance
 */
public static ComputeState createAWSComputeHost(VerificationHost host, EndpointState endpointState, String zoneId, String regionId, boolean isAwsClientMock, String awsMockEndpointReference, Set<String> tagLinks) throws Throwable {
    ComputeDescription awsComputeHostDesc = new ComputeDescription();
    if (zoneId != null) {
        awsComputeHostDesc.id = zoneId;
    } else {
        awsComputeHostDesc.id = UUID.randomUUID().toString();
    }
    awsComputeHostDesc.documentSelfLink = awsComputeHostDesc.id;
    awsComputeHostDesc.name = ComputeDescription.ENVIRONMENT_NAME_AWS;
    awsComputeHostDesc.environmentName = ComputeDescription.ENVIRONMENT_NAME_AWS;
    awsComputeHostDesc.supportedChildren = new ArrayList<String>();
    awsComputeHostDesc.supportedChildren.add(ComputeType.VM_GUEST.name());
    awsComputeHostDesc.instanceAdapterReference = UriUtils.buildUri(host, AWSUriPaths.AWS_INSTANCE_ADAPTER);
    awsComputeHostDesc.enumerationAdapterReference = UriUtils.buildUri(host, AWSUriPaths.AWS_ENUMERATION_ADAPTER);
    awsComputeHostDesc.statsAdapterReference = UriUtils.buildUri(host, AWSUriPaths.AWS_STATS_ADAPTER);
    awsComputeHostDesc.diskAdapterReference = UriUtils.buildUri(host, AWSUriPaths.AWS_DISK_ADAPTER);
    awsComputeHostDesc.zoneId = zoneId;
    awsComputeHostDesc.regionId = regionId;
    awsComputeHostDesc.authCredentialsLink = endpointState.authCredentialsLink;
    awsComputeHostDesc.tenantLinks = endpointState.tenantLinks;
    awsComputeHostDesc = TestUtils.doPost(host, awsComputeHostDesc, ComputeDescriptionService.ComputeDescription.class, UriUtils.buildUri(host, ComputeDescriptionService.FACTORY_LINK));
    ComputeState awsComputeHost = new ComputeState();
    awsComputeHost.id = awsComputeHostDesc.id;
    awsComputeHost.documentSelfLink = awsComputeHost.id;
    awsComputeHost.name = awsComputeHostDesc.name;
    awsComputeHost.type = ComputeType.ENDPOINT_HOST;
    awsComputeHost.environmentName = ComputeDescription.ENVIRONMENT_NAME_AWS;
    awsComputeHost.descriptionLink = awsComputeHostDesc.documentSelfLink;
    awsComputeHost.tagLinks = tagLinks;
    awsComputeHost.resourcePoolLink = endpointState.resourcePoolLink;
    awsComputeHost.regionId = regionId;
    awsComputeHost.endpointLink = endpointState.documentSelfLink;
    awsComputeHost.endpointLinks = new HashSet<String>();
    awsComputeHost.endpointLinks.add(endpointState.documentSelfLink);
    awsComputeHost.tenantLinks = endpointState.tenantLinks;
    if (isAwsClientMock) {
        awsComputeHost.adapterManagementReference = UriUtils.buildUri(awsMockEndpointReference);
    } else {
        awsComputeHost.adapterManagementReference = UriUtils.buildUri(awsEndpointReference);
    }
    return TestUtils.doPost(host, awsComputeHost, ComputeService.ComputeState.class, UriUtils.buildUri(host, ComputeService.FACTORY_LINK));
}
Also used : ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) ComputeService(com.vmware.photon.controller.model.resources.ComputeService)

Example 74 with ComputeDescription

use of com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription in project photon-model by vmware.

the class TestAWSSetupUtils method createAWSVMResource.

/**
 * Create a compute resource for an AWS instance.
 */
public static ComputeService.ComputeState createAWSVMResource(VerificationHost host, ComputeState computeHost, EndpointState endpointState, @SuppressWarnings("rawtypes") Class clazz, String vmName, String zoneId, String regionId, Set<String> tagLinks, AwsNicSpecs nicSpecs, boolean addNewSecurityGroup, Map<String, Object> awsTestContext, boolean persistDiskOnVmDelete, boolean withAdditionalDisks) throws Throwable {
    // Step 1: Create an auth credential to login to the VM
    AuthCredentialsServiceState auth = new AuthCredentialsServiceState();
    auth.type = DEFAULT_AUTH_TYPE;
    auth.userEmail = DEFAULT_COREOS_USER;
    auth.privateKey = TestUtils.loadTestResource(clazz, DEFAULT_COREOS_PRIVATE_KEY_FILE);
    auth = TestUtils.doPost(host, auth, AuthCredentialsServiceState.class, UriUtils.buildUri(host, AuthCredentialsService.FACTORY_LINK));
    // Step 2: Create a VM desc
    ComputeDescription awsVMDesc = new ComputeDescription();
    awsVMDesc.id = instanceType;
    awsVMDesc.name = vmName;
    awsVMDesc.environmentName = ComputeDescription.ENVIRONMENT_NAME_AWS;
    awsVMDesc.instanceType = instanceType;
    awsVMDesc.supportedChildren = new ArrayList<>();
    awsVMDesc.supportedChildren.add(ComputeType.DOCKER_CONTAINER.name());
    awsVMDesc.customProperties = new HashMap<>();
    awsVMDesc.customProperties.put(AWSConstants.AWS_SECURITY_GROUP, securityGroup);
    // set zone to east
    awsVMDesc.zoneId = zoneId;
    awsVMDesc.regionId = regionId;
    awsVMDesc.authCredentialsLink = auth.documentSelfLink;
    awsVMDesc.tenantLinks = endpointState.tenantLinks;
    awsVMDesc.endpointLink = endpointState.documentSelfLink;
    awsVMDesc.endpointLinks = new HashSet<String>();
    awsVMDesc.endpointLinks.add(endpointState.documentSelfLink);
    // set the create service to the aws instance service
    awsVMDesc.instanceAdapterReference = UriUtils.buildUri(host, AWSUriPaths.AWS_INSTANCE_ADAPTER);
    awsVMDesc.statsAdapterReference = UriUtils.buildUri(host, AWSUriPaths.AWS_STATS_ADAPTER);
    awsVMDesc = TestUtils.doPost(host, awsVMDesc, ComputeDescription.class, UriUtils.buildUri(host, ComputeDescriptionService.FACTORY_LINK));
    // Step 3: create boot disk
    List<String> vmDisks = new ArrayList<>();
    ImageState bootImage;
    {
        // Create PUBLIC image state
        bootImage = new ImageState();
        bootImage.id = imageId;
        bootImage.endpointType = endpointState.endpointType;
        bootImage.regionId = regionId;
        bootImage = TestUtils.doPost(host, bootImage, ImageState.class, UriUtils.buildUri(host, ImageService.FACTORY_LINK));
    }
    DiskState rootDisk = new DiskState();
    rootDisk.id = UUID.randomUUID().toString();
    rootDisk.documentSelfLink = rootDisk.id;
    rootDisk.name = DEFAULT_ROOT_DISK_NAME;
    rootDisk.bootOrder = 1;
    rootDisk.sourceImageReference = URI.create(imageId);
    rootDisk.imageLink = bootImage.documentSelfLink;
    rootDisk.bootConfig = new DiskState.BootConfig();
    rootDisk.bootConfig.label = DEFAULT_CONFIG_LABEL;
    DiskState.BootConfig.FileEntry file = new DiskState.BootConfig.FileEntry();
    file.path = DEFAULT_CONFIG_PATH;
    file.contents = TestUtils.loadTestResource(clazz, DEFAULT_USER_DATA_FILE);
    rootDisk.bootConfig.files = new DiskState.BootConfig.FileEntry[] { file };
    rootDisk.capacityMBytes = BOOT_DISK_SIZE_IN_MEBI_BYTES;
    // add custom properties to root disk from profile
    rootDisk.customProperties = new HashMap<>();
    rootDisk.customProperties.put(DEVICE_TYPE, "ebs");
    rootDisk.customProperties.put(VOLUME_TYPE, "io1");
    rootDisk.customProperties.put(IOPS, "500");
    rootDisk.regionId = regionId;
    rootDisk.endpointLink = endpointState.documentSelfLink;
    rootDisk.endpointLinks = new HashSet<String>();
    rootDisk.endpointLinks.add(endpointState.documentSelfLink);
    rootDisk.computeHostLink = endpointState.computeHostLink;
    rootDisk.tenantLinks = endpointState.tenantLinks;
    rootDisk = TestUtils.doPost(host, rootDisk, DiskService.DiskState.class, UriUtils.buildUri(host, DiskService.FACTORY_LINK));
    vmDisks.add(rootDisk.documentSelfLink);
    if (withAdditionalDisks) {
        List<DiskState> additionalDisks = getAdditionalDiskConfiguration(host, endpointState, computeHost, persistDiskOnVmDelete);
        for (DiskState additionalDisk : additionalDisks) {
            vmDisks.add(additionalDisk.documentSelfLink);
        }
    }
    // Create NIC States
    List<String> nicLinks = null;
    if (nicSpecs != null) {
        nicLinks = createAWSNicStates(host, computeHost, endpointState, awsVMDesc.name, nicSpecs, addNewSecurityGroup, awsTestContext).stream().map(nic -> nic.documentSelfLink).collect(Collectors.toList());
    }
    // Create compute state
    ComputeState resource;
    {
        resource = new ComputeState();
        resource.id = UUID.randomUUID().toString();
        resource.name = awsVMDesc.name;
        resource.type = ComputeType.VM_GUEST;
        resource.environmentName = ComputeDescription.ENVIRONMENT_NAME_AWS;
        resource.descriptionLink = awsVMDesc.documentSelfLink;
        resource.parentLink = computeHost.documentSelfLink;
        resource.resourcePoolLink = computeHost.resourcePoolLink;
        resource.networkInterfaceLinks = nicLinks;
        resource.diskLinks = vmDisks;
        resource.tagLinks = tagLinks;
        resource.regionId = awsVMDesc.regionId;
        resource.endpointLink = endpointState.documentSelfLink;
        resource.endpointLinks = new HashSet<String>();
        resource.endpointLinks.add(endpointState.documentSelfLink);
        resource.tenantLinks = endpointState.tenantLinks;
    }
    return TestUtils.doPost(host, resource, ComputeService.ComputeState.class, UriUtils.buildUri(host, ComputeService.FACTORY_LINK));
}
Also used : ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) ArrayList(java.util.ArrayList) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) ImageState(com.vmware.photon.controller.model.resources.ImageService.ImageState) HashSet(java.util.HashSet)

Example 75 with ComputeDescription

use of com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription in project photon-model by vmware.

the class AzureComputeEnumerationAdapterService method createComputeDescriptions.

/**
 * Creates relevant resources for given VMs.
 */
private void createComputeDescriptions(EnumerationContext ctx, ComputeEnumerationSubStages next) {
    if (ctx.virtualMachines.size() == 0 && ctx.regions.isEmpty()) {
        // nothing to create
        if (ctx.enumNextPageLink != null) {
            ctx.subStage = ComputeEnumerationSubStages.LISTVMS;
            handleSubStage(ctx);
            return;
        }
        logFine(() -> "No virtual machine found for creation.");
        ctx.subStage = ComputeEnumerationSubStages.PATCH_ADDITIONAL_FIELDS;
        handleSubStage(ctx);
        return;
    }
    logFine(() -> String.format("%d compute description with states to be created", ctx.virtualMachines.size()));
    Iterator<Entry<String, VirtualMachineInner>> iterator = ctx.virtualMachines.entrySet().iterator();
    Collection<Operation> opCollection = new ArrayList<>();
    while (iterator.hasNext()) {
        Entry<String, VirtualMachineInner> vmEntry = iterator.next();
        VirtualMachineInner virtualMachine = vmEntry.getValue();
        AuthCredentialsServiceState auth = new AuthCredentialsServiceState();
        if (virtualMachine.osProfile() != null) {
            auth.userEmail = virtualMachine.osProfile().adminUsername();
            auth.privateKey = virtualMachine.osProfile().adminPassword();
        }
        auth.documentSelfLink = UUID.randomUUID().toString();
        auth.tenantLinks = ctx.parentCompute.tenantLinks;
        auth.customProperties = new HashMap<>();
        if (ctx.request.endpointLink != null) {
            auth.customProperties.put(CUSTOM_PROP_ENDPOINT_LINK, ctx.request.endpointLink);
        }
        String authLink = UriUtils.buildUriPath(AuthCredentialsService.FACTORY_LINK, auth.documentSelfLink);
        Operation authOp = Operation.createPost(createInventoryUri(getHost(), AuthCredentialsService.FACTORY_LINK)).setBody(auth);
        opCollection.add(authOp);
        // TODO VSYM-631: Match existing descriptions for new VMs discovered on Azure
        ComputeDescription computeDescription = new ComputeDescription();
        computeDescription.id = UUID.randomUUID().toString();
        computeDescription.name = virtualMachine.name();
        computeDescription.regionId = virtualMachine.location();
        computeDescription.authCredentialsLink = authLink;
        computeDescription.endpointLink = ctx.request.endpointLink;
        AdapterUtils.addToEndpointLinks(computeDescription, ctx.request.endpointLink);
        computeDescription.documentSelfLink = computeDescription.id;
        computeDescription.environmentName = ENVIRONMENT_NAME_AZURE;
        if (virtualMachine.hardwareProfile() != null && virtualMachine.hardwareProfile().vmSize() != null) {
            computeDescription.instanceType = virtualMachine.hardwareProfile().vmSize().toString();
        }
        computeDescription.instanceAdapterReference = ctx.parentCompute.description.instanceAdapterReference;
        computeDescription.statsAdapterReference = ctx.parentCompute.description.statsAdapterReference;
        computeDescription.diskAdapterReference = ctx.parentCompute.description.diskAdapterReference;
        computeDescription.computeHostLink = ctx.parentCompute.documentSelfLink;
        computeDescription.customProperties = new HashMap<>();
        computeDescription.customProperties.put(SOURCE_TASK_LINK, ResourceEnumerationTaskService.FACTORY_LINK);
        // TODO: https://jira-hzn.eng.vmware.com/browse/VSYM-1268
        String resourceGroupName = getResourceGroupName(virtualMachine.id());
        computeDescription.customProperties.put(AZURE_RESOURCE_GROUP_NAME, resourceGroupName);
        computeDescription.tenantLinks = ctx.parentCompute.tenantLinks;
        Operation compDescOp = Operation.createPost(getHost(), ComputeDescriptionService.FACTORY_LINK).setBody(computeDescription);
        ctx.computeDescriptionIds.put(virtualMachine.name(), computeDescription.id);
        opCollection.add(compDescOp);
    }
    for (RegionInfo region : ctx.regions.values()) {
        ComputeDescription computeDescriptionForRegion = createComputeDescriptionForRegion(ctx, region);
        Operation compDescOp = Operation.createPost(getHost(), ComputeDescriptionService.FACTORY_LINK).setBody(computeDescriptionForRegion);
        ctx.computeDescriptionIds.put(region.regionId, computeDescriptionForRegion.id);
        opCollection.add(compDescOp);
    }
    OperationJoin.create(opCollection).setCompletion((ops, exs) -> {
        if (exs != null) {
            exs.values().forEach(ex -> logWarning(() -> String.format("Error: %s", ex.getMessage())));
        }
        logFine(() -> "Continue on to updating disks.");
        ctx.subStage = next;
        handleSubStage(ctx);
    }).sendWith(this);
}
Also used : PowerState(com.vmware.photon.controller.model.resources.ComputeService.PowerState) Arrays(java.util.Arrays) ComputeEnumerateResourceRequest(com.vmware.photon.controller.model.adapterapi.ComputeEnumerateResourceRequest) ServiceTypeCluster(com.vmware.photon.controller.model.util.ClusterUtil.ServiceTypeCluster) LifecycleState(com.vmware.photon.controller.model.resources.ComputeService.LifecycleState) DISK_CONTROLLER_NUMBER(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.DISK_CONTROLLER_NUMBER) Action1(rx.functions.Action1) StringUtils(org.apache.commons.lang3.StringUtils) Azure(com.microsoft.azure.management.Azure) Utils(com.vmware.xenon.common.Utils) Pair(org.apache.commons.lang3.tuple.Pair) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) Map(java.util.Map) StorageDescription(com.vmware.photon.controller.model.resources.StorageDescriptionService.StorageDescription) OSDisk(com.microsoft.azure.management.compute.OSDisk) ResourceEnumerationTaskService(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) StatelessService(com.vmware.xenon.common.StatelessService) Set(java.util.Set) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) StorageAccountTypes(com.microsoft.azure.management.compute.StorageAccountTypes) TagService(com.vmware.photon.controller.model.resources.TagService) CompletionHandler(com.vmware.xenon.common.Operation.CompletionHandler) SOURCE_TASK_LINK(com.vmware.photon.controller.model.constants.PhotonModelConstants.SOURCE_TASK_LINK) InstanceViewStatus(com.microsoft.azure.management.compute.InstanceViewStatus) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) NumericRange(com.vmware.xenon.services.common.QueryTask.NumericRange) AZURE_DATA_DISK_CACHING(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_DATA_DISK_CACHING) ImageReferenceInner(com.microsoft.azure.management.compute.implementation.ImageReferenceInner) VirtualMachinesInner(com.microsoft.azure.management.compute.implementation.VirtualMachinesInner) ComputeDescriptionService(com.vmware.photon.controller.model.resources.ComputeDescriptionService) PhotonModelUtils(com.vmware.photon.controller.model.resources.util.PhotonModelUtils) RegionInfo(com.vmware.photon.controller.model.adapterapi.RegionEnumerationResponse.RegionInfo) TagsUtil(com.vmware.photon.controller.model.adapters.util.TagsUtil) ArrayList(java.util.ArrayList) TagState(com.vmware.photon.controller.model.resources.TagService.TagState) ServiceStateCollectionUpdateRequest(com.vmware.xenon.common.ServiceStateCollectionUpdateRequest) Query(com.vmware.xenon.services.common.QueryTask.Query) EnumerationStages(com.vmware.photon.controller.model.adapters.util.enums.EnumerationStages) OperatingSystemTypes(com.microsoft.azure.management.compute.OperatingSystemTypes) BiConsumer(java.util.function.BiConsumer) AZURE_DIAGNOSTIC_STORAGE_ACCOUNT_LINK(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_DIAGNOSTIC_STORAGE_ACCOUNT_LINK) AZURE_STORAGE_ACCOUNT_URI(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_STORAGE_ACCOUNT_URI) VirtualMachineInner(com.microsoft.azure.management.compute.implementation.VirtualMachineInner) AdapterUtils(com.vmware.photon.controller.model.adapters.util.AdapterUtils) DataDisk(com.microsoft.azure.management.compute.DataDisk) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) ENVIRONMENT_NAME_AZURE(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ENVIRONMENT_NAME_AZURE) QueryTop(com.vmware.photon.controller.model.query.QueryUtils.QueryTop) CUSTOM_OS_TYPE(com.vmware.photon.controller.model.ComputeProperties.CUSTOM_OS_TYPE) ComputeStateWithDescription(com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription) PhotonModelConstants(com.vmware.photon.controller.model.constants.PhotonModelConstants) ComputeEnumerateAdapterRequest(com.vmware.photon.controller.model.adapters.util.ComputeEnumerateAdapterRequest) RegionEnumerationResponse(com.vmware.photon.controller.model.adapterapi.RegionEnumerationResponse) QuerySpecification(com.vmware.xenon.services.common.QueryTask.QuerySpecification) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) QueryTask(com.vmware.xenon.services.common.QueryTask) AZURE_RESOURCE_GROUP_NAME(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_RESOURCE_GROUP_NAME) OSType(com.vmware.photon.controller.model.ComputeProperties.OSType) AzureUriPaths(com.vmware.photon.controller.model.adapters.azure.AzureUriPaths) AZURE_MANAGED_DISK_TYPE(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_MANAGED_DISK_TYPE) ComputeType(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ComputeType) AzureSdkClients(com.vmware.photon.controller.model.adapters.azure.utils.AzureSdkClients) AzureUtils.injectOperationContext(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils.injectOperationContext) CUSTOM_PROP_ENDPOINT_LINK(com.vmware.photon.controller.model.constants.PhotonModelConstants.CUSTOM_PROP_ENDPOINT_LINK) URI(java.net.URI) TagsUtil.newTagState(com.vmware.photon.controller.model.adapters.util.TagsUtil.newTagState) EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState) AzureConstants(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants) AzureConstants.getQueryResultLimit(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.getQueryResultLimit) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) Occurance(com.vmware.xenon.services.common.QueryTask.Query.Occurance) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) List(java.util.List) AzureUtils(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils) AzureUtils.getResourceGroupName(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils.getResourceGroupName) TAG_KEY_TYPE(com.vmware.photon.controller.model.constants.PhotonModelConstants.TAG_KEY_TYPE) Entry(java.util.Map.Entry) NetworkInterfacesInner(com.microsoft.azure.management.network.implementation.NetworkInterfacesInner) QueryOption(com.vmware.xenon.services.common.QueryTask.QuerySpecification.QueryOption) InstanceViewTypes(com.microsoft.azure.management.compute.InstanceViewTypes) TagsUtil.setTagLinksToResourceState(com.vmware.photon.controller.model.adapters.util.TagsUtil.setTagLinksToResourceState) Builder(com.vmware.xenon.services.common.QueryTask.Query.Builder) DiskService(com.vmware.photon.controller.model.resources.DiskService) AzureUtils.isDiskManaged(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils.isDiskManaged) Default(com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback.Default) QueryByPages(com.vmware.photon.controller.model.query.QueryUtils.QueryByPages) AZURE_OSDISK_CACHING(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AZURE_OSDISK_CACHING) PublicIPAddress(com.microsoft.azure.management.network.PublicIPAddress) HashMap(java.util.HashMap) HashSet(java.util.HashSet) AuthCredentialsService(com.vmware.xenon.services.common.AuthCredentialsService) TagsUtil.updateLocalTagStates(com.vmware.photon.controller.model.adapters.util.TagsUtil.updateLocalTagStates) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) EnumerationAction(com.vmware.photon.controller.model.adapterapi.EnumerationAction) AzureResourceType(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType) ExecutorService(java.util.concurrent.ExecutorService) Iterator(java.util.Iterator) NetworkInterfaceIPConfigurationInner(com.microsoft.azure.management.network.implementation.NetworkInterfaceIPConfigurationInner) Operation(com.vmware.xenon.common.Operation) Page(com.microsoft.azure.Page) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) NetworkInterfaceReferenceInner(com.microsoft.azure.management.compute.implementation.NetworkInterfaceReferenceInner) AzureDeferredResultServiceCallback(com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback) NetworkInterfaceInner(com.microsoft.azure.management.network.implementation.NetworkInterfaceInner) Collections(java.util.Collections) OperationJoin(com.vmware.xenon.common.OperationJoin) RESOURCE_GROUP_NAME(com.vmware.photon.controller.model.ComputeProperties.RESOURCE_GROUP_NAME) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) ArrayList(java.util.ArrayList) RegionInfo(com.vmware.photon.controller.model.adapterapi.RegionEnumerationResponse.RegionInfo) Operation(com.vmware.xenon.common.Operation) Entry(java.util.Map.Entry) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) VirtualMachineInner(com.microsoft.azure.management.compute.implementation.VirtualMachineInner)

Aggregations

ComputeDescription (com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription)78 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)39 Operation (com.vmware.xenon.common.Operation)21 ArrayList (java.util.ArrayList)21 QueryTask (com.vmware.xenon.services.common.QueryTask)17 Test (org.junit.Test)17 ComputeDescriptionService (com.vmware.photon.controller.model.resources.ComputeDescriptionService)15 ComputeService (com.vmware.photon.controller.model.resources.ComputeService)15 HashMap (java.util.HashMap)15 HashSet (java.util.HashSet)15 List (java.util.List)15 Utils (com.vmware.xenon.common.Utils)14 AuthCredentialsServiceState (com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState)14 URI (java.net.URI)14 QueryUtils (com.vmware.photon.controller.model.query.QueryUtils)13 ResourcePoolState (com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState)12 ServiceDocumentQueryResult (com.vmware.xenon.common.ServiceDocumentQueryResult)12 UriUtils (com.vmware.xenon.common.UriUtils)12 ComputeType (com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ComputeType)11 EndpointState (com.vmware.photon.controller.model.resources.EndpointService.EndpointState)11