Search in sources :

Example 1 with ResourceObjectType

use of com.cloud.server.ResourceTag.ResourceObjectType in project cloudstack by apache.

the class QueryManagerImpl method listDetailOptions.

@Override
public DetailOptionsResponse listDetailOptions(final ListDetailOptionsCmd cmd) {
    final ResourceObjectType type = cmd.getResourceType();
    final String resourceUuid = cmd.getResourceId();
    final Map<String, List<String>> options = new HashMap<>();
    switch(type) {
        case Template:
        case UserVm:
            HypervisorType hypervisorType = HypervisorType.None;
            if (StringUtils.isNotEmpty(resourceUuid) && ResourceObjectType.Template.equals(type)) {
                hypervisorType = _templateDao.findByUuid(resourceUuid).getHypervisorType();
            }
            if (StringUtils.isNotEmpty(resourceUuid) && ResourceObjectType.UserVm.equals(type)) {
                hypervisorType = _vmInstanceDao.findByUuid(resourceUuid).getHypervisorType();
            }
            fillVMOrTemplateDetailOptions(options, hypervisorType);
            break;
        default:
            throw new CloudRuntimeException("Resource type not supported.");
    }
    if (CallContext.current().getCallingAccount().getType() != Account.ACCOUNT_TYPE_ADMIN) {
        final List<String> userDenyListedSettings = Stream.of(QueryService.UserVMDeniedDetails.value().split(",")).map(item -> (item).trim()).collect(Collectors.toList());
        for (final String detail : userDenyListedSettings) {
            if (options.containsKey(detail)) {
                options.remove(detail);
            }
        }
    }
    return new DetailOptionsResponse(options);
}
Also used : HypervisorType(com.cloud.hypervisor.Hypervisor.HypervisorType) ServiceOfferingJoinVO(com.cloud.api.query.vo.ServiceOfferingJoinVO) ListTemplatesCmd(org.apache.cloudstack.api.command.user.template.ListTemplatesCmd) HostTagVO(com.cloud.api.query.vo.HostTagVO) ListProjectAccountsCmd(org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd) ListProjectResourcesCriteria(com.cloud.projects.Project.ListProjectResourcesCriteria) DomainManager(com.cloud.user.DomainManager) EventResponse(org.apache.cloudstack.api.response.EventResponse) TemplateDataStoreDao(org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao) StringUtils(org.apache.commons.lang3.StringUtils) ListIsosCmd(org.apache.cloudstack.api.command.user.iso.ListIsosCmd) RouterHealthCheckResult(com.cloud.network.RouterHealthCheckResult) DiskOffering(com.cloud.offering.DiskOffering) StoragePoolTagVO(com.cloud.storage.StoragePoolTagVO) Map(java.util.Map) StorageTagResponse(org.apache.cloudstack.api.response.StorageTagResponse) ListStorageTagsCmd(org.apache.cloudstack.api.command.admin.storage.ListStorageTagsCmd) ListZonesCmdByAdmin(org.apache.cloudstack.api.command.admin.zone.ListZonesCmdByAdmin) ListProjectInvitationsCmd(org.apache.cloudstack.api.command.user.project.ListProjectInvitationsCmd) DiskOfferingResponse(org.apache.cloudstack.api.response.DiskOfferingResponse) StoragePoolResponse(org.apache.cloudstack.api.response.StoragePoolResponse) QueryService(org.apache.cloudstack.query.QueryService) ProjectAccountJoinVO(com.cloud.api.query.vo.ProjectAccountJoinVO) ListInternalLBVMsCmd(org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd) ProjectInvitation(com.cloud.projects.ProjectInvitation) ProjectManager(com.cloud.projects.ProjectManager) ResourceTagVO(com.cloud.tags.ResourceTagVO) Stream(java.util.stream.Stream) Project(com.cloud.projects.Project) ServiceOfferingVO(com.cloud.service.ServiceOfferingVO) VolumeApiServiceImpl(com.cloud.storage.VolumeApiServiceImpl) ProjectInvitationJoinVO(com.cloud.api.query.vo.ProjectInvitationJoinVO) ResourceIconResponse(org.apache.cloudstack.api.response.ResourceIconResponse) AffinityGroupDomainMapDao(org.apache.cloudstack.affinity.dao.AffinityGroupDomainMapDao) VMTemplateDao(com.cloud.storage.dao.VMTemplateDao) ProjectInvitationDao(com.cloud.projects.dao.ProjectInvitationDao) DataCenterJoinVO(com.cloud.api.query.vo.DataCenterJoinVO) ResourceMetaDataService(com.cloud.server.ResourceMetaDataService) ImageStoreJoinVO(com.cloud.api.query.vo.ImageStoreJoinVO) UserDao(com.cloud.user.dao.UserDao) SearchCriteria(com.cloud.utils.db.SearchCriteria) DomainRouterVO(com.cloud.vm.DomainRouterVO) DomainRouterJoinDao(com.cloud.api.query.dao.DomainRouterJoinDao) User(com.cloud.user.User) DiskOfferingDetailsDao(org.apache.cloudstack.resourcedetail.dao.DiskOfferingDetailsDao) AffinityGroupVMMapDao(org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao) ListAccountsCmdByAdmin(org.apache.cloudstack.api.command.admin.account.ListAccountsCmdByAdmin) ListZonesCmd(org.apache.cloudstack.api.command.user.zone.ListZonesCmd) ResourceTag(com.cloud.server.ResourceTag) HostJoinVO(com.cloud.api.query.vo.HostJoinVO) ListUsersCmd(org.apache.cloudstack.api.command.admin.user.ListUsersCmd) ResourceTagResponse(org.apache.cloudstack.api.response.ResourceTagResponse) HighAvailabilityManager(com.cloud.ha.HighAvailabilityManager) CloudAuthenticationException(com.cloud.exception.CloudAuthenticationException) ProjectAccountResponse(org.apache.cloudstack.api.response.ProjectAccountResponse) DomainJoinDao(com.cloud.api.query.dao.DomainJoinDao) UserVmDao(com.cloud.vm.dao.UserVmDao) ListSecurityGroupsCmd(org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCmd) ListDiskOfferingsCmd(org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd) ListDetailOptionsCmd(org.apache.cloudstack.api.command.user.resource.ListDetailOptionsCmd) ResourceDetail(org.apache.cloudstack.api.ResourceDetail) SecurityGroupResponse(org.apache.cloudstack.api.response.SecurityGroupResponse) ListVMsCmdByAdmin(org.apache.cloudstack.api.command.admin.vm.ListVMsCmdByAdmin) ConfigurationDao(org.apache.cloudstack.framework.config.dao.ConfigurationDao) ServiceOfferingResponse(org.apache.cloudstack.api.response.ServiceOfferingResponse) ListMgmtsCmd(org.apache.cloudstack.api.command.admin.management.ListMgmtsCmd) ListIterator(java.util.ListIterator) Date(java.util.Date) ListResourceIconCmd(org.apache.cloudstack.api.command.admin.resource.icon.ListResourceIconCmd) UserVmJoinVO(com.cloud.api.query.vo.UserVmJoinVO) DataStore(org.apache.cloudstack.engine.subsystem.api.storage.DataStore) StoragePoolDetailVO(org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO) ResourceObjectType(com.cloud.server.ResourceTag.ResourceObjectType) InstanceGroupJoinVO(com.cloud.api.query.vo.InstanceGroupJoinVO) ResourceIconDao(com.cloud.resource.icon.dao.ResourceIconDao) VMInstanceVO(com.cloud.vm.VMInstanceVO) RouterHealthCheckResultDao(com.cloud.network.dao.RouterHealthCheckResultDao) ListIsosCmdByAdmin(org.apache.cloudstack.api.command.admin.iso.ListIsosCmdByAdmin) Pair(com.cloud.utils.Pair) Collectors(java.util.stream.Collectors) DiskOfferingVO(com.cloud.storage.DiskOfferingVO) VirtualMachineManager(com.cloud.vm.VirtualMachineManager) DedicatedResourceVO(com.cloud.dc.DedicatedResourceVO) DomainResponse(org.apache.cloudstack.api.response.DomainResponse) HostTagDao(com.cloud.api.query.dao.HostTagDao) VirtualMachine(com.cloud.vm.VirtualMachine) TemplateFilter(com.cloud.template.VirtualMachineTemplate.TemplateFilter) ProjectAccountJoinDao(com.cloud.api.query.dao.ProjectAccountJoinDao) ListDomainsCmdByAdmin(org.apache.cloudstack.api.command.admin.domain.ListDomainsCmdByAdmin) EventJoinDao(com.cloud.event.dao.EventJoinDao) DataStoreManager(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager) StoragePoolJoinDao(com.cloud.api.query.dao.StoragePoolJoinDao) DiskOfferingDao(com.cloud.storage.dao.DiskOfferingDao) SecurityGroupJoinVO(com.cloud.api.query.vo.SecurityGroupJoinVO) Domain(com.cloud.domain.Domain) GetRouterHealthCheckResultsCmd(org.apache.cloudstack.api.command.admin.router.GetRouterHealthCheckResultsCmd) HashSet(java.util.HashSet) Inject(javax.inject.Inject) ConfigKey(org.apache.cloudstack.framework.config.ConfigKey) VolumeJoinVO(com.cloud.api.query.vo.VolumeJoinVO) ManagementServerHostDao(com.cloud.cluster.dao.ManagementServerHostDao) AsyncJobJoinVO(com.cloud.api.query.vo.AsyncJobJoinVO) AsyncJobJoinDao(com.cloud.api.query.dao.AsyncJobJoinDao) ListImageStoresCmd(org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd) VolumeDao(com.cloud.storage.dao.VolumeDao) ImageStoreResponse(org.apache.cloudstack.api.response.ImageStoreResponse) PermissionDeniedException(com.cloud.exception.PermissionDeniedException) VMTemplateVO(com.cloud.storage.VMTemplateVO) DomainRouterResponse(org.apache.cloudstack.api.response.DomainRouterResponse) ListAffinityGroupsCmd(org.apache.cloudstack.api.command.user.affinitygroup.ListAffinityGroupsCmd) ZoneResponse(org.apache.cloudstack.api.response.ZoneResponse) ApiConstants(org.apache.cloudstack.api.ApiConstants) ProjectResponse(org.apache.cloudstack.api.response.ProjectResponse) TemplateState(org.apache.cloudstack.engine.subsystem.api.storage.TemplateState) DataStoreRole(com.cloud.storage.DataStoreRole) StoragePoolVO(org.apache.cloudstack.storage.datastore.db.StoragePoolVO) VMTemplateDetailsDao(com.cloud.storage.dao.VMTemplateDetailsDao) SecurityGroupJoinDao(com.cloud.api.query.dao.SecurityGroupJoinDao) ListHostsCmd(org.apache.cloudstack.api.command.admin.host.ListHostsCmd) HostTagResponse(org.apache.cloudstack.api.response.HostTagResponse) VirtualNetworkApplianceManager(com.cloud.network.router.VirtualNetworkApplianceManager) Arrays(java.util.Arrays) UserVmJoinDao(com.cloud.api.query.dao.UserVmJoinDao) ProjectJoinVO(com.cloud.api.query.vo.ProjectJoinVO) RouterHealthCheckResultVO(com.cloud.network.dao.RouterHealthCheckResultVO) ServiceOfferingDetailsDao(com.cloud.service.dao.ServiceOfferingDetailsDao) TemplateType(com.cloud.storage.Storage.TemplateType) ServiceOfferingDao(com.cloud.service.dao.ServiceOfferingDao) TemplateResponse(org.apache.cloudstack.api.response.TemplateResponse) SecurityGroupVMMapVO(com.cloud.network.security.SecurityGroupVMMapVO) Storage(com.cloud.storage.Storage) CallContext(org.apache.cloudstack.context.CallContext) EventJoinVO(com.cloud.api.query.vo.EventJoinVO) ResourceManager(com.cloud.resource.ResourceManager) HostJoinDao(com.cloud.api.query.dao.HostJoinDao) Set(java.util.Set) ProjectJoinDao(com.cloud.api.query.dao.ProjectJoinDao) ScopeType(com.cloud.storage.ScopeType) ListAccountsCmd(org.apache.cloudstack.api.command.user.account.ListAccountsCmd) StoragePoolJoinVO(com.cloud.api.query.vo.StoragePoolJoinVO) DomainJoinVO(com.cloud.api.query.vo.DomainJoinVO) ResourceDetailResponse(org.apache.cloudstack.api.response.ResourceDetailResponse) ImageStoreJoinDao(com.cloud.api.query.dao.ImageStoreJoinDao) ServiceOfferingJoinDao(com.cloud.api.query.dao.ServiceOfferingJoinDao) AccountDao(com.cloud.user.dao.AccountDao) ListResponse(org.apache.cloudstack.api.response.ListResponse) BaseListProjectAndAccountResourcesCmd(org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd) NumbersUtil(com.cloud.utils.NumbersUtil) ListTagsCmd(org.apache.cloudstack.api.command.user.tag.ListTagsCmd) AffinityGroupDomainMapVO(org.apache.cloudstack.affinity.AffinityGroupDomainMapVO) ArrayList(java.util.ArrayList) DiskOfferingJoinDao(com.cloud.api.query.dao.DiskOfferingJoinDao) AffinityGroupJoinDao(com.cloud.api.query.dao.AffinityGroupJoinDao) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) AccountJoinDao(com.cloud.api.query.dao.AccountJoinDao) VolumeJoinDao(com.cloud.api.query.dao.VolumeJoinDao) SecurityGroupVMMapDao(com.cloud.network.security.dao.SecurityGroupVMMapDao) VMInstanceDao(com.cloud.vm.dao.VMInstanceDao) DomainRouterDao(com.cloud.vm.dao.DomainRouterDao) HypervisorType(com.cloud.hypervisor.Hypervisor.HypervisorType) Op(com.cloud.utils.db.SearchCriteria.Op) ProjectInvitationResponse(org.apache.cloudstack.api.response.ProjectInvitationResponse) ProjectDao(com.cloud.projects.dao.ProjectDao) InstanceGroupJoinDao(com.cloud.api.query.dao.InstanceGroupJoinDao) DiskOfferingJoinVO(com.cloud.api.query.vo.DiskOfferingJoinVO) ResourceTagDao(com.cloud.tags.dao.ResourceTagDao) AffinityGroupJoinVO(com.cloud.api.query.vo.AffinityGroupJoinVO) ProjectAccountDao(com.cloud.projects.dao.ProjectAccountDao) State(com.cloud.template.VirtualMachineTemplate.State) AccountManager(com.cloud.user.AccountManager) ListResourceDetailsCmd(org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd) ImageFormat(com.cloud.storage.Storage.ImageFormat) ListServiceOfferingsCmd(org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd) StoragePoolTagsDao(com.cloud.storage.dao.StoragePoolTagsDao) RouterHealthCheckResultResponse(org.apache.cloudstack.api.response.RouterHealthCheckResultResponse) ListDomainsCmd(org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd) DataStoreDriver(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver) ManagementServerResponse(org.apache.cloudstack.api.response.ManagementServerResponse) Grouping(com.cloud.org.Grouping) Func(com.cloud.utils.db.SearchCriteria.Func) Filter(com.cloud.utils.db.Filter) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) UserAccountJoinDao(com.cloud.api.query.dao.UserAccountJoinDao) Logger(org.apache.log4j.Logger) JoinBuilder(com.cloud.utils.db.JoinBuilder) ResponseGenerator(org.apache.cloudstack.api.ResponseGenerator) ListStoragePoolsCmd(org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd) DomainDao(com.cloud.domain.dao.DomainDao) ResourceTagJoinDao(com.cloud.api.query.dao.ResourceTagJoinDao) ProjectVO(com.cloud.projects.ProjectVO) PrimaryDataStoreDao(org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao) ResourceManagerUtil(com.cloud.server.ResourceManagerUtil) HostResponse(org.apache.cloudstack.api.response.HostResponse) ListVolumesCmd(org.apache.cloudstack.api.command.user.volume.ListVolumesCmd) VpcVirtualNetworkApplianceService(com.cloud.network.VpcVirtualNetworkApplianceService) ListVMsCmd(org.apache.cloudstack.api.command.user.vm.ListVMsCmd) Account(com.cloud.user.Account) DedicatedResourceDao(com.cloud.dc.dao.DedicatedResourceDao) AsyncJobResponse(org.apache.cloudstack.api.response.AsyncJobResponse) ListRoutersCmd(org.apache.cloudstack.api.command.admin.router.ListRoutersCmd) List(java.util.List) DataCenterJoinDao(com.cloud.api.query.dao.DataCenterJoinDao) ListHostTagsCmd(org.apache.cloudstack.api.command.admin.host.ListHostTagsCmd) ACLType(org.apache.cloudstack.acl.ControlledEntity.ACLType) ListProjectsCmd(org.apache.cloudstack.api.command.user.project.ListProjectsCmd) ResponseView(org.apache.cloudstack.api.ResponseObject.ResponseView) InstanceGroupResponse(org.apache.cloudstack.api.response.InstanceGroupResponse) ListEventsCmd(org.apache.cloudstack.api.command.user.event.ListEventsCmd) TaggedResourceService(com.cloud.server.TaggedResourceService) DetailOptionsResponse(org.apache.cloudstack.api.response.DetailOptionsResponse) VolumeResponse(org.apache.cloudstack.api.response.VolumeResponse) SearchBuilder(com.cloud.utils.db.SearchBuilder) UserAccountJoinVO(com.cloud.api.query.vo.UserAccountJoinVO) HashMap(java.util.HashMap) UserResponse(org.apache.cloudstack.api.response.UserResponse) TemplateJoinVO(com.cloud.api.query.vo.TemplateJoinVO) VmDetailConstants(com.cloud.vm.VmDetailConstants) DataStoreCapabilities(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities) StoragePoolDetailsDao(org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao) CollectionUtils(org.apache.commons.collections.CollectionUtils) Configurable(org.apache.cloudstack.framework.config.Configurable) ListSecondaryStagingStoresCmd(org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd) ListAsyncJobsCmd(org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd) AffinityGroupResponse(org.apache.cloudstack.affinity.AffinityGroupResponse) UserVmResponse(org.apache.cloudstack.api.response.UserVmResponse) ResourceTagJoinVO(com.cloud.api.query.vo.ResourceTagJoinVO) DomainRouterJoinVO(com.cloud.api.query.vo.DomainRouterJoinVO) AffinityGroupVMMapVO(org.apache.cloudstack.affinity.AffinityGroupVMMapVO) ManagementServerHostVO(com.cloud.cluster.ManagementServerHostVO) Hypervisor(com.cloud.hypervisor.Hypervisor) DateUtil(com.cloud.utils.DateUtil) TemplateJoinDao(com.cloud.api.query.dao.TemplateJoinDao) Component(org.springframework.stereotype.Component) UserVmVO(com.cloud.vm.UserVmVO) ProjectInvitationJoinDao(com.cloud.api.query.dao.ProjectInvitationJoinDao) Ternary(com.cloud.utils.Ternary) GenericSearchBuilder(com.cloud.utils.db.GenericSearchBuilder) Volume(com.cloud.storage.Volume) ListVMGroupsCmd(org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd) AccountResponse(org.apache.cloudstack.api.response.AccountResponse) AccountJoinVO(com.cloud.api.query.vo.AccountJoinVO) DomainVO(com.cloud.domain.DomainVO) ListTemplatesCmdByAdmin(org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin) Collections(java.util.Collections) ResourceObjectType(com.cloud.server.ResourceTag.ResourceObjectType) DetailOptionsResponse(org.apache.cloudstack.api.response.DetailOptionsResponse) HashMap(java.util.HashMap) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

AccountJoinDao (com.cloud.api.query.dao.AccountJoinDao)1 AffinityGroupJoinDao (com.cloud.api.query.dao.AffinityGroupJoinDao)1 AsyncJobJoinDao (com.cloud.api.query.dao.AsyncJobJoinDao)1 DataCenterJoinDao (com.cloud.api.query.dao.DataCenterJoinDao)1 DiskOfferingJoinDao (com.cloud.api.query.dao.DiskOfferingJoinDao)1 DomainJoinDao (com.cloud.api.query.dao.DomainJoinDao)1 DomainRouterJoinDao (com.cloud.api.query.dao.DomainRouterJoinDao)1 HostJoinDao (com.cloud.api.query.dao.HostJoinDao)1 HostTagDao (com.cloud.api.query.dao.HostTagDao)1 ImageStoreJoinDao (com.cloud.api.query.dao.ImageStoreJoinDao)1 InstanceGroupJoinDao (com.cloud.api.query.dao.InstanceGroupJoinDao)1 ProjectAccountJoinDao (com.cloud.api.query.dao.ProjectAccountJoinDao)1 ProjectInvitationJoinDao (com.cloud.api.query.dao.ProjectInvitationJoinDao)1 ProjectJoinDao (com.cloud.api.query.dao.ProjectJoinDao)1 ResourceTagJoinDao (com.cloud.api.query.dao.ResourceTagJoinDao)1 SecurityGroupJoinDao (com.cloud.api.query.dao.SecurityGroupJoinDao)1 ServiceOfferingJoinDao (com.cloud.api.query.dao.ServiceOfferingJoinDao)1 StoragePoolJoinDao (com.cloud.api.query.dao.StoragePoolJoinDao)1 TemplateJoinDao (com.cloud.api.query.dao.TemplateJoinDao)1 UserAccountJoinDao (com.cloud.api.query.dao.UserAccountJoinDao)1