本文整理汇总了Java中com.vmware.xenon.common.Operation.createPatch方法的典型用法代码示例。如果您正苦于以下问题:Java Operation.createPatch方法的具体用法?Java Operation.createPatch怎么用?Java Operation.createPatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.xenon.common.Operation
的用法示例。
在下文中一共展示了Operation.createPatch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateLoadBalancerState
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private DeferredResult<AWSLoadBalancerContext> updateLoadBalancerState(
AWSLoadBalancerContext context) {
LoadBalancerState loadBalancerState = new LoadBalancerState();
loadBalancerState.address = context.loadBalancerStateExpanded.address;
loadBalancerState.name = context.loadBalancerStateExpanded.name;
if (context.provisionedSecurityGroupState != null) {
loadBalancerState.securityGroupLinks = Collections
.singletonList(context.provisionedSecurityGroupState.documentSelfLink);
}
Operation op = Operation
.createPatch(this, context.loadBalancerStateExpanded.documentSelfLink);
op.setBody(loadBalancerState);
return this.sendWithDeferredResult(op).thenApply(ignore -> context);
}
示例2: createComputeDescriptionOp
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private Operation createComputeDescriptionOp(EndpointAllocationTaskState currentState,
String computeDescriptionLink) {
if (currentState.accountAlreadyExists) {
return Operation.createPatch(this, computeDescriptionLink);
}
return Operation.createPost(this, ComputeDescriptionService.FACTORY_LINK);
}
示例3: createComputeStateOp
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private Operation createComputeStateOp(EndpointAllocationTaskState currentState,
String computeStateLink) {
if (currentState.accountAlreadyExists) {
return Operation.createPatch(this, computeStateLink);
}
return Operation.createPost(this, ComputeService.FACTORY_LINK);
}
示例4: testSubscriptionEndpointCreation
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Test
public void testSubscriptionEndpointCreation() throws Throwable {
AzureSubscriptionEndpointCreationRequest request = new
AzureSubscriptionEndpointCreationRequest();
request.resourceReference = UriUtils.buildUri(this.host, this.eaEndPointLink);
request.subscriptionId = SUBSCRIPTION_ID;
request.accountId = ACCOUNT_ID;
Operation endPointCreationOp = Operation.createPatch(this.host,
AzureSubscriptionEndpointCreationService.SELF_LINK);
endPointCreationOp.setBody(request);
TestRequestSender sender = new TestRequestSender(this.host);
EndpointState subscriptionEndpoint = sender.sendAndWait(endPointCreationOp,
EndpointState.class);
//Assert the subscriptionEndpoint created
Assert.assertEquals(this.eaEndPointLink, subscriptionEndpoint.parentLink);
Assert.assertNotNull(subscriptionEndpoint
.endpointProperties.get(EndpointConfigRequest.USER_LINK_KEY));
Assert.assertEquals(SUBSCRIPTION_ID, subscriptionEndpoint
.endpointProperties.get(EndpointConfigRequest.USER_LINK_KEY));
ComputeState cs = getServiceSynchronously(subscriptionEndpoint.computeLink,
ComputeState.class);
Assert.assertNotNull(cs.customProperties.get(AzureConstants.AZURE_ACCOUNT_OWNER_EMAIL_ID));
Assert.assertEquals(ACCOUNT_ID,
cs.customProperties.get(AzureConstants.AZURE_ACCOUNT_OWNER_EMAIL_ID));
Assert.assertNotNull(cs.customProperties.get(AzureConstants.AZURE_SUBSCRIPTION_ID_KEY));
Assert.assertEquals(SUBSCRIPTION_ID,
cs.customProperties.get(AzureConstants.AZURE_SUBSCRIPTION_ID_KEY));
}
示例5: createUpdateLocalResourceState
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
protected DeferredResult<Operation> createUpdateLocalResourceState(
LocalStateHolder localStateHolder) {
final ResourceState localState = localStateHolder.localState;
if (localState == this.SKIP) {
return DeferredResult.completed(null);
}
final LOCAL_STATE currentState = this.localResourceStates.get(localState.id);
// POST or PATCH local state
final Operation localStateOp;
if (currentState == null) {
// Create case
if (localState.regionId == null) {
// By default populate REGION_ID, if not already set by descendant
localState.regionId = getEndpointRegion();
}
if (isApplyInfraFields()) {
// By default populate TENANT_LINKS
localState.tenantLinks = this.endpointState.tenantLinks;
// By default populate ENDPOINT_LINK
setEndpointLink(localState, this.endpointState.documentSelfLink);
updateEndpointLinks(localState, this.endpointState.documentSelfLink);
}
localState.computeHostLink = this.computeHostLink;
localStateOp = Operation.createPost(this.service, this.localStateServiceFactoryLink);
} else {
// Update case
if (isApplyInfraFields()) {
setEndpointLink(localState, this.endpointState.documentSelfLink);
// update the endpointLinks
updateEndpointLinks(localState, this.endpointState.documentSelfLink);
}
localStateOp = Operation.createPatch(this.service, currentState.documentSelfLink);
}
DeferredResult<Set<String>> tagLinksDR = TagsUtil.createOrUpdateTagStates(
this.service,
localState,
currentState,
localStateHolder.remoteTags, localStateHolder.internalTagLinks);
return tagLinksDR
.thenApply(tagLinks -> {
localState.tagLinks = tagLinks;
localStateOp.setBodyNoCloning(localState);
return localStateOp;
})
.thenCompose(this.service::sendWithDeferredResult)
.whenComplete((ignoreOp, exc) -> {
String msg = "%s local %s(id=%s) to match remote resources";
if (exc != null) {
this.service.logWarning(
() -> String.format(msg + ": FAILED with %s",
localStateOp.getAction(),
localState.getClass().getSimpleName(),
localState.id,
Utils.toString(exc)));
} else {
this.service.log(Level.FINEST,
() -> String.format(msg + ": SUCCESS",
localStateOp.getAction(),
localState.getClass().getSimpleName(),
localState.id));
}
});
}