本文整理汇总了Java中com.vmware.xenon.common.Operation.createDelete方法的典型用法代码示例。如果您正苦于以下问题:Java Operation.createDelete方法的具体用法?Java Operation.createDelete怎么用?Java Operation.createDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.xenon.common.Operation
的用法示例。
在下文中一共展示了Operation.createDelete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteSubnetState
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private DeferredResult<ResourceState> deleteSubnetState(ResourceState stateToDelete) {
if (stateToDelete == null) {
// The AWS subnet deletion has failed. See deleteAWSSubnet method.
// Do not delete SubnetState and continue with Instance deletion.
return DeferredResult.completed(stateToDelete);
}
AWSInstanceService.this.logInfo(() -> String.format("Deleting Subnet state [%s]"
+ " 'created-by' [%s]", stateToDelete.documentSelfLink,
this.context.computeRequest.resourceLink()));
Operation delOp = Operation.createDelete(AWSInstanceService.this,
stateToDelete.documentSelfLink);
return AWSInstanceService.this.sendWithDeferredResult(delOp)
.thenApply(ignore -> stateToDelete);
}
示例2: deleteDiskState
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
* Finish the disk delete operation by cleaning up the disk reference in the system.
*/
private void deleteDiskState(AWSDiskContext ctx, AwsDiskStage next) {
List<Operation> ops = new ArrayList<>();
Operation op1 = Operation.createDelete(this, ctx.disk.documentSelfLink);
ops.add(op1);
// Clean up disk description link if it is present.
if (ctx.disk.customProperties != null && !ctx.disk.customProperties.isEmpty()) {
String diskDescLink = ctx.disk.customProperties.get(PhotonModelConstants.TEMPLATE_DISK_LINK);
if (diskDescLink != null) {
Operation op2 = Operation.createDelete(this, diskDescLink);
ops.add(op2);
}
}
OperationJoin.create(ops)
.setCompletion((o, e) -> {
if (e != null && !e.isEmpty()) {
handleStages(ctx, new Throwable(Utils.toString(e)));
return;
}
handleStages(ctx, next);
})
.sendWith(this);
}
示例3: testDeleteRequestHeader
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Test
public void testDeleteRequestHeader() throws Throwable {
EndpointService.EndpointState startState = buildValidStartState();
EndpointService.EndpointState returnState = postServiceSynchronously(
EndpointService.FACTORY_LINK,
startState, EndpointState.class);
Operation deleteOperation = Operation
.createDelete(UriUtils.buildUri(this.host, returnState.documentSelfLink));
// custom header is not set in delete request, expect failure
this.host.sendAndWaitExpectFailure(deleteOperation);
// set custom header
deleteOperation.addRequestHeader(ENDPOINT_REMOVAL_REQUEST_REFERRER_NAME,
ENDPOINT_REMOVAL_REQUEST_REFERRER_VALUE);
// custom header is set in delete request, expect success
this.host.sendAndWaitExpectSuccess(deleteOperation);
}
示例4: testDeletePragmaDirective
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Test
public void testDeletePragmaDirective() throws Throwable {
EndpointService.EndpointState startState = buildValidStartState();
EndpointService.EndpointState returnState = postServiceSynchronously(
EndpointService.FACTORY_LINK,
startState, EndpointState.class);
Operation deleteOperation = Operation
.createDelete(UriUtils.buildUri(this.host, returnState.documentSelfLink));
// custom header is not set in delete request, expect failure
this.host.sendAndWaitExpectFailure(deleteOperation);
// set custom header
deleteOperation.addPragmaDirective(Operation.PRAGMA_DIRECTIVE_FROM_MIGRATION_TASK);
// custom header is set in delete request, expect success
this.host.sendAndWaitExpectSuccess(deleteOperation);
}
示例5: deleteConfig
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
public void deleteConfig() {
ServiceHost configHost = this.gatewayHost.getConfigHost();
Operation op = Operation
.createDelete(configHost, this.configState.documentSelfLink);
this.sender.sendAndWait(op);
this.configState = null;
}
示例6: doInstanceDelete
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
* Delete endpoint
*
*/
private void doInstanceDelete(EndpointRemovalTaskState currentState, SubStage next) {
EndpointState endpoint = currentState.endpoint;
Operation crdOp = Operation.createDelete(createInventoryUri(this.getHost(),
endpoint.authCredentialsLink));
Operation epOp = Operation.createDelete(createInventoryUri(this.getHost(),
endpoint.documentSelfLink));
// custom header identifier for endpoint service to validate before deleting endpoint
epOp.addRequestHeader(ENDPOINT_REMOVAL_REQUEST_REFERRER_NAME,
ENDPOINT_REMOVAL_REQUEST_REFERRER_VALUE);
OperationJoin.create(crdOp, epOp).setCompletion((ops, exc) -> {
if (exc != null) {
// failing to delete the endpoint itself is considered a critical error
Throwable endpointRemovalException = exc.get(epOp.getId());
if (endpointRemovalException != null) {
sendFailureSelfPatch(endpointRemovalException);
return;
}
// other removal exceptions are just warnings
logFine(() -> String.format("Failed delete some of the associated resources,"
+ " reason %s", Utils.toString(exc)));
}
// Endpoint and AuthCredentials are deleted; mark the operation as complete
sendSelfPatch(TaskStage.STARTED, next);
}).sendWith(this);
}
示例7: deleteSubnet
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
private DeferredResult<Void> deleteSubnet(Void start) {
Operation op = Operation.createDelete(
PhotonModelUriUtils.createInventoryUri(getService().getHost(),getRequest()
.resourceReference));
return getService().sendWithDeferredResult(op).thenAccept(__ -> { });
}
示例8: deleteDisk
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
* Delete disk request to remove the reference from the system as the disk is deleted on the
* server.
*/
private Operation deleteDisk(String documentSelfLink) {
return Operation.createDelete(
PhotonModelUriUtils.createInventoryUri(getHost(), documentSelfLink));
}