use of com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest in project photon-model by vmware.
the class AzureLifecycleOperationService method handlePatch.
@Override
public void handlePatch(Operation op) {
if (!op.hasBody()) {
op.fail(new IllegalArgumentException("body is required"));
return;
}
ResourceOperationRequest request = op.getBody(ResourceOperationRequest.class);
op.complete();
AzureLifecycleOperationContext ctx = new AzureLifecycleOperationContext(this, request);
logInfo("Handle operation %s for compute %s.", request.operation, request.resourceLink());
if (request.isMockRequest) {
updateComputeState(ctx);
return;
}
ctx.populateBaseContext(BaseAdapterStage.VMDESC).whenComplete((ignoreCtx, e) -> {
if (e != null) {
logSevere("Error populating base context during Azure resource operation %s for resource %s failed with error %s", request.operation, request.resourceReference, Utils.toString(e));
ctx.finishExceptionally(e);
return;
}
ctx.vmName = ctx.child.name != null ? ctx.child.name : ctx.child.id;
ctx.rgName = AzureUtils.getResourceGroupName(ctx);
applyResourceOperation(ctx);
});
}
Aggregations