Search in sources :

Example 1 with SubnetInstanceRequest

use of com.vmware.photon.controller.model.adapterapi.SubnetInstanceRequest in project photon-model by vmware.

the class ProvisionSubnetTaskService method toReq.

private SubnetInstanceRequest toReq(ProvisionSubnetTaskState taskState) {
    SubnetInstanceRequest req = new SubnetInstanceRequest();
    req.requestType = taskState.requestType;
    req.resourceReference = createInventoryUri(this.getHost(), taskState.subnetLink);
    req.taskReference = this.getUri();
    req.isMockRequest = taskState.options.contains(TaskOption.IS_MOCK);
    return req;
}
Also used : SubnetInstanceRequest(com.vmware.photon.controller.model.adapterapi.SubnetInstanceRequest)

Example 2 with SubnetInstanceRequest

use of com.vmware.photon.controller.model.adapterapi.SubnetInstanceRequest in project photon-model by vmware.

the class DvsNetworkService method handlePatch.

@Override
public void handlePatch(Operation op) {
    if (!op.hasBody()) {
        op.fail(new IllegalArgumentException("body is required"));
        return;
    }
    SubnetInstanceRequest req = op.getBody(SubnetInstanceRequest.class);
    if (req.isMockRequest) {
        new TaskManager(this, req.taskReference, req.resourceLink()).patchTask(TaskStage.FINISHED);
        op.complete();
    }
    if (req.requestType == InstanceRequestType.CREATE) {
        op.complete();
        new CreatePortgroupFlow(this, op, req).provisionAsync();
        return;
    }
    if (req.requestType == InstanceRequestType.DELETE) {
        op.complete();
        new DeletePortgroupFlow(this, op, req).provisionAsync();
        return;
    }
    op.fail(new IllegalArgumentException("bad request type"));
}
Also used : TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) SubnetInstanceRequest(com.vmware.photon.controller.model.adapterapi.SubnetInstanceRequest)

Aggregations

SubnetInstanceRequest (com.vmware.photon.controller.model.adapterapi.SubnetInstanceRequest)2 TaskManager (com.vmware.photon.controller.model.adapters.util.TaskManager)1