/** * @deprecated Use the handlePatch overload with a service arg */ @Deprecated public static <T extends ResourceState> void handlePatch(Operation op, T currentState, ServiceDocumentDescription description, Class<T> stateClass, Function<Operation, Boolean> customPatchHandler) { handlePatch(null, op, currentState, description, stateClass, customPatchHandler); }
@Override public void handlePatch(Operation patch) { ResourceGroupState currentState = getState(patch); ResourceUtils.handlePatch(patch, currentState, getStateDescription(), ResourceGroupState.class, null); }
@Override public void handlePatch(Operation patchOp) { ResourceUtils.handlePatch( patchOp, getState(patchOp), getStateDescription(), ImageState.class, null); }
@Override public void handlePatch(Operation patch) { SnapshotState currentState = getState(patch); ResourceUtils.handlePatch(patch, currentState, getStateDescription(), SnapshotState.class, null); }
@Override public void handlePatch(Operation patch) { ResourceDescription currentState = getState(patch); ResourceUtils.handlePatch(patch, currentState, getStateDescription(), ResourceDescription.class, null); }
@Override public void handlePatch(Operation patch) { SnapshotState currentState = getState(patch); ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), SnapshotState.class, null); }
@Override public void handlePatch(Operation patch) { ResourceGroupState currentState = getState(patch); ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), ResourceGroupState.class, null); }
@Override public void handlePatch(Operation patchOp) { ResourceUtils.handlePatch( patchOp, getState(patchOp), getStateDescription(), RouterState.class, null); }
@Override public void handlePatch(Operation patch) { ResourceDescription currentState = getState(patch); ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), ResourceDescription.class, null); }
@Override public void handlePatch(Operation patch) { DiskState currentState = getState(patch); Function<Operation, Boolean> customPatchHandler = new Function<Operation, Boolean>() { @Override public Boolean apply(Operation t) { DiskState patchBody = patch.getBody(DiskState.class); boolean hasStateChanged = false; if (patchBody.capacityMBytes != 0 && patchBody.capacityMBytes != currentState.capacityMBytes) { currentState.capacityMBytes = patchBody.capacityMBytes; hasStateChanged = true; } return hasStateChanged; } }; ResourceUtils.handlePatch(patch, currentState, getStateDescription(), DiskState.class, customPatchHandler); }
@Override public void handlePatch(Operation patch) { LoadBalancerState currentState = getState(patch); ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), LoadBalancerState.class, op -> { LoadBalancerState patchBody = op.getBody(LoadBalancerState.class); boolean hasChanged = false; // if routes are passed, they override the current ones if (patchBody.routes != null) { hasChanged = true; currentState.routes = patchBody.routes; } // make sure the securityGroupLinks are patched with new values only Pair<List<String>, Boolean> securityGroupLinksMergeResult = PhotonModelUtils.mergeLists( currentState.securityGroupLinks, patchBody.securityGroupLinks); currentState.securityGroupLinks = securityGroupLinksMergeResult.getLeft(); hasChanged = hasChanged || securityGroupLinksMergeResult.getRight(); return Boolean.valueOf(hasChanged); }); }
@Override public void handlePatch(Operation patchOp) { try { ResourceUtils.handlePatch(this, patchOp, getState(patchOp), getStateDescription(), RouterState.class, null); } catch (Throwable t) { patchOp.fail(t); } }
@Override public void handlePatch(Operation patch) { NetworkState currentState = getState(patch); ResourceUtils.handlePatch(patch, currentState, getStateDescription(), NetworkState.class, t -> { NetworkState patchBody = patch.getBody(NetworkState.class); boolean hasStateChanged = false; if (patchBody.endpointLink != null && currentState.endpointLink == null) { currentState.endpointLink = patchBody.endpointLink; hasStateChanged = true; } return hasStateChanged; }); }
@Override public void handlePatch(Operation patch) { ResourcePoolState currentState = getState(patch); if (!currentState.properties.contains(ResourcePoolProperty.ELASTIC)) { // clean auto-generated query to catch patches with unexpected query currentState.query = null; } // use standard resource merging with an additional custom handler for the query ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), ResourcePoolState.class, op -> { // check state and re-generate the query, if needed validateState(currentState); if (!currentState.properties.contains(ResourcePoolProperty.ELASTIC)) { currentState.query = generateResourcePoolQuery(currentState); } // don't report a state change, it is already reported if resource pool type has // changed return false; }); }
@Override public void handlePatch(Operation patch) { SubnetState currentState = getState(patch); ResourceUtils.handlePatch(patch, currentState, getStateDescription(), SubnetState.class, t -> { SubnetState patchBody = patch.getBody(SubnetState.class); boolean hasStateChanged = false; if (patchBody.endpointLink != null && currentState.endpointLink == null) { currentState.endpointLink = patchBody.endpointLink; hasStateChanged = true; } return hasStateChanged; }); }
@Override public void handlePatch(Operation patch) { NetworkState currentState = getState(patch); ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), NetworkState.class, t -> { NetworkState patchBody = patch.getBody(NetworkState.class); boolean hasStateChanged = false; if (patchBody.endpointLink != null && currentState.endpointLink == null) { currentState.endpointLink = patchBody.endpointLink; hasStateChanged = true; } return hasStateChanged; }); }
@Override public void handlePatch(Operation patch) { StorageDescription currentState = getState(patch); Function<Operation, Boolean> customPatchHandler = t -> { boolean hasStateChanged = false; StorageDescription patchBody = patch.getBody(StorageDescription.class); if (patchBody.creationTimeMicros != null && currentState.creationTimeMicros == null && currentState.creationTimeMicros != patchBody.creationTimeMicros) { currentState.creationTimeMicros = patchBody.creationTimeMicros; hasStateChanged = true; } return hasStateChanged; }; ResourceUtils.handlePatch(patch, currentState, getStateDescription(), StorageDescription.class, customPatchHandler); }
@Override public void handlePatch(Operation patch) { StorageDescription currentState = getState(patch); Function<Operation, Boolean> customPatchHandler = t -> { boolean hasStateChanged = false; StorageDescription patchBody = patch.getBody(StorageDescription.class); if (patchBody.creationTimeMicros != null && currentState.creationTimeMicros == null && currentState.creationTimeMicros != patchBody.creationTimeMicros) { currentState.creationTimeMicros = patchBody.creationTimeMicros; hasStateChanged = true; } return hasStateChanged; }; ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), StorageDescription.class, customPatchHandler); }
@Override public void handlePatch(Operation patch) { EndpointState currentState = getState(patch); EndpointState newState = patch.getBody(EndpointState.class); validateUpdates(currentState, newState); ResourceUtils.handlePatch(patch, currentState, getStateDescription(), EndpointState.class, null); }
@Override public void handlePatch(Operation patch) { EndpointState currentState = getState(patch); EndpointState newState = patch.getBody(EndpointState.class); validateUpdates(currentState, newState); ResourceUtils.handlePatch(this, patch, currentState, getStateDescription(), EndpointState.class, op -> { EndpointState patchBody = op.getBody(EndpointState.class); boolean hasStateChanged = false; if (currentState.creationTimeMicros == null && patchBody.creationTimeMicros != null) { currentState.creationTimeMicros = patchBody.creationTimeMicros; hasStateChanged = true; } return hasStateChanged; }); }