当前位置: 首页>>代码示例>>Java>>正文


Java UriUtils.extendUriWithQuery方法代码示例

本文整理汇总了Java中com.vmware.xenon.common.UriUtils.extendUriWithQuery方法的典型用法代码示例。如果您正苦于以下问题:Java UriUtils.extendUriWithQuery方法的具体用法?Java UriUtils.extendUriWithQuery怎么用?Java UriUtils.extendUriWithQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vmware.xenon.common.UriUtils的用法示例。


在下文中一共展示了UriUtils.extendUriWithQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVMDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private void getVMDescription(AWSStatsDataHolder statsData) {
    Consumer<Operation> onSuccess = (op) -> {
        statsData.computeDesc = op.getBody(ComputeStateWithDescription.class);
        statsData.isComputeHost = isComputeHost(statsData.computeDesc);

        // if we have a compute host then we directly get the auth.
        if (statsData.isComputeHost) {
            getParentAuth(statsData);
        } else {
            getParentVMDescription(statsData);
        }
    };
    URI computeUri = UriUtils.extendUriWithQuery(statsData.statsRequest.resourceReference,
            UriUtils.URI_PARAM_ODATA_EXPAND,
            Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:18,代码来源:AWSStatsService.java

示例2: getAccountDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
protected void getAccountDescription(AWSCostStatsCreationContext statsData,
        AWSCostStatsCreationStages next) {
    Consumer<Operation> onSuccess = (op) -> {
        ComputeStateWithDescription compute = op.getBody(ComputeStateWithDescription.class);
        statsData.computeDesc = compute;
        inferEndpointLink(statsData);
        String accountId = AWSUtils.isAwsS3Proxy() ? "mock" : compute.customProperties.get(AWS_ACCOUNT_ID_KEY);
        if (compute.type != ComputeType.VM_HOST || compute.parentLink != null
                || compute.endpointLink == null || accountId == null ||
                CollectionUtils.isEmpty(compute.endpointLinks)) {

            logWithContext(statsData, Level.SEVERE, () -> "Malformed Root Compute.");
            postAccumulatedCostStats(statsData, true);
            return;
        }
        statsData.accountId = accountId;
        statsData.awsAccountIdToComputeStates.put(accountId, Collections.singletonList(compute));
        getEndpointState(statsData, next);
    };
    URI computeUri = UriUtils.extendUriWithQuery(statsData.statsRequest.resourceReference,
            UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:24,代码来源:AWSCostStatsService.java

示例3: getVMDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
 * Gets the description of the VM for which stats are to be collected.
 * Sets the VM ID, required for making metric requests, in current GCPStatsDataHolder
 * instance.
 * @param statsData The GCPStatsDataHolder instance containing statsRequest.
 * @param nextStage The next stage of StatsCollectionStage for the service.
 */
private void getVMDescription(GCPStatsDataHolder statsData,
        StatsCollectionStage nextStageForVM,
        StatsCollectionStage nextStageForComputeHost) {
    Consumer<Operation> onSuccess = (op) -> {
        statsData.computeDesc = op.getBody(ComputeStateWithDescription.class);
        statsData.instanceId = statsData.computeDesc.id;
        statsData.isComputeHost = AdapterUtils.isComputeHost(statsData.computeDesc);

        // If the given resource is a compute host, directly get parent auth.
        if (statsData.isComputeHost) {
            statsData.stage = nextStageForComputeHost;
        } else {
            statsData.stage = nextStageForVM;
        }
        handleStatsRequest(statsData);
    };
    URI computeUri = UriUtils.extendUriWithQuery(statsData.statsRequest.resourceReference,
            UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:28,代码来源:GCPStatsService.java

示例4: getRequestUriForVM

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
 * Method for building VM level stats metric request URI.
 * The URI has nested key, value pairs in the query.
 * Use of UriUtils methods for creating the entire query results in double encoding, thus
 * manual string concatenation is used.
 * @param metricName Name of the metric to be requested.
 * @param statsData The GCPStatsDataHolder instance containing statsRequest.
 * @return Metric request URI for VM level stats.
 */
private URI getRequestUriForVM(String metricName, GCPStatsDataHolder statsData) {
    try {
        URI baseUri = new URI(GCPConstants.MONITORING_API_URI
                + statsData.projectId + GCPConstants.TIMESERIES_PREFIX);

        String filterValue = getRequestFilterValue(metricName, statsData);

        URI uri = UriUtils.extendUriWithQuery(baseUri, GCPConstants.FILTER_KEY, filterValue,
                GCPConstants.INTERVAL_START_TIME, getStartTime(),
                GCPConstants.INTERVAL_END_TIME, getEndTime());

        return uri;
    } catch (URISyntaxException e) {
        handleError(statsData, e);
        return null;
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:27,代码来源:GCPStatsService.java

示例5: getOldDetailedBillRequest

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@OldApi
static Request getOldDetailedBillRequest(String enrollmentNumber, String accessToken,
        LocalDate billMonthToDownload) {
    String baseUri = AdapterUriUtil
            .expandUriPathTemplate(AzureCostConstants.OLD_EA_USAGE_REPORT, enrollmentNumber);
    String dateInBillingApiExpectedFormat = getDateInBillingApiFormat(
            billMonthToDownload);

    URI uri = UriUtils.extendUriWithQuery(UriUtils.buildUri(baseUri),
            AzureCostConstants.QUERY_PARAM_BILL_MONTH, dateInBillingApiExpectedFormat,
            AzureCostConstants.QUERY_PARAM_BILL_TYPE,
            AzureCostConstants.QUERY_PARAM_BILL_TYPE_VALUE_DETAILED,
            AzureCostConstants.QUERY_PARAM_RESPONSE_FORMAT,
            AzureCostConstants.QUERY_PARAM_RESPONSE_FORMAT_VALUE_CSV);

    return new Request
            .Builder()
            .url(uri.toString())
            .addHeader(Operation.AUTHORIZATION_HEADER,
                    AzureConstants.AUTH_HEADER_BEARER_PREFIX + accessToken)
            .addHeader(AzureCostConstants.API_VERSION_HEADER,
                    AzureCostConstants.API_VERSION_HEADER_VALUE).build();
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:24,代码来源:AzureCostHelper.java

示例6: getOldBillAvailableMonths

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@OldApi
static Operation getOldBillAvailableMonths(String enrollmentNumber, String accessToken) {
    String baseUri = AdapterUriUtil
            .expandUriPathTemplate(AzureCostConstants.OLD_EA_BILL_AVAILABLE_MONTHS,
                    enrollmentNumber);
    // Get the summarized bill in JSON format and detailed bill in CSV format.
    URI uri = UriUtils.extendUriWithQuery(UriUtils.buildUri(baseUri));

    logger.info(String.format("Request: %s", uri.toString()));

    Operation operation = Operation.createGet(uri);
    addDefaultRequestHeaders(operation, accessToken);
    // Retry thrice on failure.
    operation = operation.setRetryCount(3);
    operation = setExpirationForExternalRequests(operation);
    return operation;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:18,代码来源:AzureCostHelper.java

示例7: getVMComputeStatesWithPrefix

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
/**
 * Filters and returns all compute states with a VM name starting with a particular prefix.
 * @param vmPrefix A VM name prefix for distinguishing relevant compute states.
 * @return A map of ComputeStates with a prefix, with each VM name as the key.
 */
private Map<String, ComputeState> getVMComputeStatesWithPrefix(String vmPrefix) {
    URI queryUri = UriUtils.buildExpandLinksQueryUri(createServiceURI(host,
            host.getUri(), ComputeService.FACTORY_LINK));

    // add limit, otherwise the query will not return if there are too many docs or versions
    queryUri = UriUtils.extendUriWithQuery(queryUri, UriUtils.URI_PARAM_ODATA_LIMIT,
            String.valueOf(numOfVMsToTest * 2));
    ServiceDocumentQueryResult res = host.getFactoryState(queryUri);

    // Add compute states with the prefix to map.
    Map<String, ComputeService.ComputeState> filteredComputeStates = new HashMap<>();
    for (String key : res.documents.keySet()) {
        String json = Utils.toJson(res.documents.get(key));
        ComputeService.ComputeState doc = Utils.fromJson(json,
                ComputeService.ComputeState.class);
        if (doc.name.startsWith(vmPrefix)) {
            filteredComputeStates.put(doc.name, doc);
        }
    }

    return filteredComputeStates;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:28,代码来源:TestAzureLongRunningEnumeration.java

示例8: getParentVMDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private void getParentVMDescription(AzureStatsDataHolder statsData) {
    Consumer<Operation> onSuccess = (op) -> {
        statsData.parentDesc = op.getBody(ComputeStateWithDescription.class);
        getParentAuth(statsData);
    };
    URI computeUri = UriUtils.extendUriWithQuery(
            UriUtils.buildUri(getHost(), statsData.computeDesc.parentLink),
            UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:11,代码来源:AzureComputeStatsGatherer.java

示例9: getParentVMDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private void getParentVMDescription(AWSStatsDataHolder statsData) {
    Consumer<Operation> onSuccess = (op) -> {
        statsData.parentDesc = op.getBody(ComputeStateWithDescription.class);
        getParentAuth(statsData);
    };
    URI computeUri = UriUtils.extendUriWithQuery(
            UriUtils.buildUri(getHost(), statsData.computeDesc.parentLink),
            UriUtils.URI_PARAM_ODATA_EXPAND,
            Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:12,代码来源:AWSStatsService.java

示例10: getAccountDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
protected void getAccountDescription(AWSReservedInstanceContext context, String computeLink) {
    Consumer<Operation> onSuccess = (op) -> {
        context.computeDesc = op.getBody(ComputeService.ComputeStateWithDescription.class);
        getParentAuth(context);
    };
    URI computeUri = UriUtils.extendUriWithQuery(UriUtils
                    .extendUri(getInventoryServiceUri(), computeLink),
            UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(context,
            "Error while retrieving compute description"));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:12,代码来源:AWSReservedInstancePlanService.java

示例11: getVMDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private void getVMDescription(AWSMockStatsDataHolder statsData) {
    Consumer<Operation> onSuccess = (op) -> {
        statsData.computeState = op.getBody(ComputeStateWithDescription.class);
        statsData.isComputeHost = isComputeHost(statsData.computeState.description);
        if (statsData.isComputeHost) {
            getMockStats(statsData, METRIC_NAMES);
        } else {
            getParentVMDescription(statsData);
        }
    };
    URI computeUri = UriUtils.extendUriWithQuery(statsData.statsRequest.resourceReference,
            UriUtils.URI_PARAM_ODATA_EXPAND,
            Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:16,代码来源:AWSMockStatsService.java

示例12: getParentVMDescription

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private void getParentVMDescription(AWSMockStatsDataHolder statsData) {
    Consumer<Operation> onSuccess = (op) -> {
        statsData.parentComputeState = op.getBody(ComputeStateWithDescription.class);
        getMockStats(statsData, METRIC_NAMES);
    };
    URI computeUri = UriUtils.extendUriWithQuery(
            UriUtils.buildUri(getHost(), statsData.computeState.parentLink),
            UriUtils.URI_PARAM_ODATA_EXPAND,
            Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeUri, onSuccess, getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:12,代码来源:AWSMockStatsService.java

示例13: getDocument

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
protected <T> T getDocument(Class<T> type, String selfLink, String... keyValues)
        throws Throwable {
    testCreate(1);
    URI uri = UriUtils.buildUri(this.host, selfLink);
    uri = UriUtils.extendUriWithQuery(uri, keyValues);
    return getDocument(type, uri);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:8,代码来源:BaseTestCase.java

示例14: getEndpointState

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
protected void getEndpointState(Context context, Stages next) {
    Consumer<Operation> onEndpointSuccess = (op) -> {
        context.endpointState = op.getBody(EndpointState.class);
        logInfo(() -> String.format("Azure ea cost stats endpoint state link: %s",
                context.endpointState.documentSelfLink));
        getAuth(context, next);
    };
    URI endpointUri = UriUtils.extendUriWithQuery(UriUtils.buildUri(this.getHost(), context.endpointLink),
            UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, endpointUri, onEndpointSuccess, getFailureConsumer(context));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:12,代码来源:AzureCostStatsService.java

示例15: getComputeHost

import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private void getComputeHost(AzureStatsDataHolder statsData, ComputeHostMetricsStages next) {
    Consumer<Operation> onSuccess = (op) -> {
        statsData.computeHost = op.getBody(ComputeService.ComputeStateWithDescription.class);
        statsData.stage = next;
        handleMetricDiscovery(statsData);
    };
    URI computeHostUri = UriUtils.extendUriWithQuery(statsData.statsRequest.resourceReference,
            UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString());
    AdapterUtils.getServiceState(this, computeHostUri, onSuccess,
            getFailureConsumer(statsData));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:12,代码来源:AzureComputeHostStatsGatherer.java


注:本文中的com.vmware.xenon.common.UriUtils.extendUriWithQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。