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


Java Operation.createGet方法代码示例

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


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

示例1: handleGet

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handleGet(Operation get) {
    Operation op = Operation.createGet(this, "/");
    op.setCompletion((o, e) -> {
        SwaggerAssembler
                .create(this)
                .setExcludedPrefixes(this.excludedPrefixes)
                .setStripPackagePrefixes(this.stripPackagePrefixes)
                .setSupportLevel(this.supportLevel)
                .setInfo(this.info)
                .setPostprocessor(this.swaggerPostprocessor)
                .setExcludeUtilities(this.excludeUtilities)
                .setQueryResult(o.getBody(ServiceDocumentQueryResult.class))
                .build(get);
    });

    getHost().queryServiceUris(
            // all services
            EnumSet.noneOf(ServiceOption.class),
            true,
            op,
            // exclude factory items
            EnumSet.of(ServiceOption.FACTORY_ITEM));
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:25,代码来源:SwaggerDescriptorService.java

示例2: getEndpointStateByLink

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Resolve specific End-point by link.
 */
private DeferredResult<SendImageEnumerationAdapterContext> getEndpointStateByLink(
        SendImageEnumerationAdapterContext ctx) {

    Operation op = Operation.createGet(this, ctx.taskState.endpointLink);

    return sendWithDeferredResult(op, EndpointState.class)

            // Populate context
            .thenAccept(epState -> ctx.endpointState = epState)

            // Informative logging
            .thenRun(() -> {
                final String regionStr = isNullOrEmpty(ctx.taskState.regionId)
                        ? "n/a"
                        : ctx.taskState.regionId;

                logInfo(() -> String.format(
                        "[getEndpointStateByLink] '%s' endpoint of (type=%s, region=%s): SUCCESS",
                        ctx.endpointState.name,
                        ctx.endpointState.endpointType,
                        regionStr));
            })

            .thenApply(__ -> ctx);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:29,代码来源:ImageEnumerationTaskService.java

示例3: getPermissions

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private DeferredResult<PermissionList> getPermissions(
        AuthCredentialsServiceState credentials) {

    logFine(() -> String.format("Retrieving permissions for subscription with id [%s]",
            credentials.userLink));

    String uriStr = AdapterUriUtil.expandUriPathTemplate(PROVIDER_PERMISSIONS_URI,
            credentials.userLink, AUTHORIZATION_NAMESPACE);
    URI uri = UriUtils.extendUriWithQuery(UriUtils.buildUri(uriStr),
            QUERY_PARAM_API_VERSION, PROVIDER_REST_API_VERSION);

    Operation operation = Operation.createGet(uri);
    operation.addRequestHeader(Operation.ACCEPT_HEADER, Operation.MEDIA_TYPE_APPLICATION_JSON);
    operation.addRequestHeader(Operation.CONTENT_TYPE_HEADER,
            Operation.MEDIA_TYPE_APPLICATION_JSON);

    try {
        operation.addRequestHeader(Operation.AUTHORIZATION_HEADER,
                AUTH_HEADER_BEARER_PREFIX
                        + getAzureConfig(credentials).getToken(AzureUtils.getAzureBaseUri()));
    } catch (IOException e) {
        return DeferredResult.failed(e);
    }
    return sendWithDeferredResult(operation, PermissionList.class);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:26,代码来源:AzureEndpointAdapterService.java

示例4: getParentDescription

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Populate context with parent {@code ComputeStateWithDescription}.
 * <p>
 * <p>
 * By default {@code context.child.parentLink} is used as source.
 */
protected DeferredResult<T> getParentDescription(T context) {

    URI ref = context.child != null
            // 'child' is already resolved so used it
            ? UriUtils.buildUri(context.service.getHost(), context.child.parentLink)
            // state machine starts from here so resRef should point to the parent
            : context.resourceReference;

    ref = ComputeStateWithDescription.buildUri(ref);

    Operation op = Operation.createGet(ref);

    return context.service
            .sendWithDeferredResult(op, ComputeStateWithDescription.class)
            .thenApply(state -> {
                context.parent = state;
                return context;
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:26,代码来源:BaseAdapterContext.java

示例5: collectRegions

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private void collectRegions(EnumerationContext ctx, ComputeEnumerationSubStages next) {
    Operation getEndpoint = Operation.createGet(this, ctx.request.endpointLink);

    DeferredResult<EndpointState> getEndpointDR = sendWithDeferredResult(getEndpoint,
            EndpointState.class);
    getEndpointDR
            .thenCompose(endpoint -> {
                Operation getRegions = Operation
                        .createPost(this, AzureRegionEnumerationAdapterService.SELF_LINK)
                        .setBody(endpoint);

                return sendWithDeferredResult(getRegions, RegionEnumerationResponse.class);
            }).whenComplete((regionsResponse, e) -> {
                if (e != null) {
                    logWarning("Resource enumeration failed at stage %s with exception %s",
                            ctx.stage, Utils.toString(e));
                    handleError(ctx, e);
                } else {
                    ctx.regions.putAll(regionsResponse.regions.stream()
                            .collect(Collectors.toMap(r -> r.regionId, r -> r)));
                    ctx.regionIds.addAll(ctx.regions.keySet());
                    ctx.subStage = next;
                    handleSubStage(ctx);
                }
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:27,代码来源:AzureComputeEnumerationAdapterService.java

示例6: getOldBillAvailableMonths

import com.vmware.xenon.common.Operation; //导入方法依赖的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: getAuthentication

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
protected DeferredResult<Context> getAuthentication(Context context) {

            if (this.request.authCredentialsLink == null) {
                AzureEndpointAdapterService.credentials().accept(
                        context.authentication = new AuthCredentialsServiceState(),
                        EndpointAdapterUtils.Retriever.of(this.request.endpointProperties));

                return DeferredResult.completed(context);
            }

            Operation op = Operation.createGet(createInventoryUri(
                    context.service.getHost(),
                    context.request.authCredentialsLink));

            return context.service
                    .sendWithDeferredResult(op, AuthCredentialsServiceState.class)
                    .thenApply(state -> {
                        context.authentication = state;
                        return context;
                    });
        }
 
开发者ID:vmware,项目名称:photon-model,代码行数:22,代码来源:AzureRegionEnumerationAdapterService.java

示例8: getImageEnumerationAdapterReference

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Go to {@link PhotonModelAdaptersRegistryService Service Registry} and get the
 * 'image-enumeration' URI for passed end-point.
 *
 * @return <code>null</code> is returned if 'image-enumeration' adapter is not registered by
 *         passed end-point.
 *
 * @see PhotonModelAdapterConfig
 * @see AdapterTypePath#IMAGE_ENUMERATION_ADAPTER
 */
private DeferredResult<SendImageEnumerationAdapterContext> getImageEnumerationAdapterReference(
        SendImageEnumerationAdapterContext ctx) {

    // We use 'endpointType' (such as aws, azure) as AdapterConfig id/selfLink!
    String uri = buildUriPath(
            PhotonModelAdaptersRegistryService.FACTORY_LINK, ctx.endpointState.endpointType);

    Operation getEndpointConfigOp = Operation.createGet(this, uri);

    return sendWithDeferredResult(getEndpointConfigOp, PhotonModelAdapterConfig.class)
            .thenApply(endpointConfig -> {
                // Lookup the 'image-enumeration' URI for passed end-point
                if (endpointConfig.adapterEndpoints != null) {

                    String uriStr = endpointConfig.adapterEndpoints.get(
                            AdapterTypePath.IMAGE_ENUMERATION_ADAPTER.key);

                    if (uriStr != null && !uriStr.isEmpty()) {
                        ctx.adapterRef = URI.create(uriStr);
                    }
                }

                logInfo(() -> String.format(
                        "[getImageEnumerationAdapterReference] adapterRef = %s: SUCCESS",
                        ctx.adapterRef));

                return ctx;
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:40,代码来源:ImageEnumerationTaskService.java

示例9: getEndpointState

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Retrieve endpoint state by the provided endpointLink.
 */
private DeferredResult<Context> getEndpointState(Context context) {
    AssertUtil.assertNotEmpty(context.endpointLink, "endpointLink is required.");

    Operation endpointOp = Operation.createGet(UriUtils.buildUri(getHost(), context
            .endpointLink));

    return sendWithDeferredResult(endpointOp, EndpointState.class)
            .thenApply(endpointState -> {
                // Store endpoint state in the context.
                context.endpointState = endpointState;
                return context;
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:17,代码来源:AWSInstanceTypeService.java

示例10: getImageEnumTaskState

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Extract {@link ImageEnumerationTaskState} from {@code request.taskReference} and set it
 * to {@link #imageEnumTaskState}.
 */
private DeferredResult<AWSImageEnumerationContext> getImageEnumTaskState(
        AWSImageEnumerationContext context) {

    Operation op = Operation.createGet(context.request.taskReference);

    return context.service
            .sendWithDeferredResult(op, ImageEnumerationTaskState.class)
            .thenApply(state -> {
                context.imageEnumTaskState = state;
                return context;
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:17,代码来源:AWSImageEnumerationAdapterService.java

示例11: fetchNetwork

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private DeferredResult<Operation> fetchNetwork(Operation stateOp) {
    this.subnetState = stateOp.getBody(SubnetState.class);
    String dvsLink = this.subnetState.networkLink;
    if (dvsLink == null) {
        return DeferredResult.failed(new IllegalArgumentException("Portgroup must be linked to a parent DVS"));
    }

    Operation op = Operation.createGet(
            PhotonModelUriUtils.createInventoryUri(getService().getHost(), dvsLink));
    return getService().sendWithDeferredResult(op);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:12,代码来源:DeletePortgroupFlow.java

示例12: getImageEnumTaskState

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Extract {@link ImageEnumerationTaskState} from {@code request.taskReference} and set it
 * to {@link #imageEnumTaskState}.
 */
private DeferredResult<AzureImageEnumerationContext> getImageEnumTaskState(
        AzureImageEnumerationContext context) {

    Operation op = Operation.createGet(context.request.taskReference);

    return context.service
            .sendWithDeferredResult(op, ImageEnumerationTaskState.class)
            .thenApply(state -> {
                context.imageEnumTaskState = state;
                context.imageFilter = createImageFilter(context.imageEnumTaskState.filter);

                return context;
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:19,代码来源:AzureImageEnumerationAdapterService.java

示例13: getEndpointState

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Resolve {@code EndpointState} from {@link #endpointReference} and set it to
 * {@link #endpointState}.
 */
protected DeferredResult<T> getEndpointState(T context) {

    Operation op = Operation.createGet(context.endpointReference);

    return context.service
            .sendWithDeferredResult(op, EndpointState.class)
            .thenApply(state -> {
                context.endpointState = state;
                return context;
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:16,代码来源:EndpointEnumerationProcess.java

示例14: getParentAuth

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Populate context with endpoint {@code AuthCredentialsServiceState}.
 *
 * @see #getParentAuthRef(BaseAdapterContext) for any customization.
 */
protected DeferredResult<T> getParentAuth(T context) {

    URI parentAuthRef = getParentAuthRef(context);

    Operation op = Operation.createGet(parentAuthRef);

    return context.service
            .sendWithDeferredResult(op, AuthCredentialsServiceState.class)
            .thenApply(state -> {
                context.parentAuth = state;
                context.endpointAuth = state;
                return context;
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:20,代码来源:BaseAdapterContext.java

示例15: getImageSource

import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
 * Helper method to load {@link ImageSource} either from {@code ImageState} that is pointed by
 * {@code bootDisk.imageLink} or directly from {@code bootDisk.sourceImageReference}.
 */
public DeferredResult<ImageSource> getImageSource(DiskState bootDisk) {

    if (bootDisk == null) {
        return DeferredResult.failed(new IllegalStateException("bootDisk should be specified"));
    }

    if (bootDisk.sourceImageReference == null && bootDisk.imageLink == null) {
        return DeferredResult.failed(new IllegalStateException(
                "Either bootDisk.sourceImageReference or bootDisk.imageLink should be specified"));
    }

    final DeferredResult<ImageSource> imageSourceDR;

    if (bootDisk.imageLink != null) {
        // Either get ImageState as pointed by 'bootDisk.imageLink'
        Operation getImageStateOp = Operation.createGet(
                this.service.getHost(), bootDisk.imageLink);

        imageSourceDR = this.service
                .sendWithDeferredResult(getImageStateOp, ImageState.class)
                .thenApply(ImageSource::fromImageState);
    } else {
        // Or use directly 'bootDisk.sourceImageReference' as 'image native id'
        imageSourceDR = DeferredResult.completed(
                ImageSource.fromRef(bootDisk.sourceImageReference.toString()));
    }

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


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