Add REST method for update rollout (#1749)
* adds PUT method for updating name and description of a rollout * restrict RolloutUpdate to changing only name and description * small refactoring Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -13,13 +13,11 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
|
||||
/**
|
||||
* Builder for {@link Rollout}.
|
||||
*
|
||||
*/
|
||||
public interface RolloutBuilder {
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* of the updatable entity
|
||||
* @param id of the updatable entity
|
||||
* @return builder instance
|
||||
*/
|
||||
RolloutUpdate update(long id);
|
||||
@@ -28,5 +26,4 @@ public interface RolloutBuilder {
|
||||
* @return builder instance
|
||||
*/
|
||||
RolloutCreate create();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,11 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
*
|
||||
*/
|
||||
public interface RolloutCreate {
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param name
|
||||
* for {@link Rollout#getName()}
|
||||
* @param name for {@link Rollout#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
@@ -40,8 +40,7 @@ public interface RolloutCreate {
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param description
|
||||
* for {@link Rollout#getDescription()}
|
||||
* @param description for {@link Rollout#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
@@ -49,28 +48,25 @@ public interface RolloutCreate {
|
||||
/**
|
||||
* Set the {@link DistributionSet}
|
||||
*
|
||||
* @param set
|
||||
* for {@link Rollout#getDistributionSet()}
|
||||
* @param set for {@link Rollout#getDistributionSet()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
default RolloutCreate set(final DistributionSet set) {
|
||||
return set(Optional.ofNullable(set).map(DistributionSet::getId).orElse(null));
|
||||
default RolloutCreate distributionSetId(final DistributionSet set) {
|
||||
return distributionSetId(Optional.ofNullable(set).map(DistributionSet::getId).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the id of the {@link DistributionSet}
|
||||
*
|
||||
* @param setId
|
||||
* for {@link Rollout#getDistributionSet()}
|
||||
* @param distributionSetId for {@link Rollout#getDistributionSet()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate set(long setId);
|
||||
RolloutCreate distributionSetId(long distributionSetId);
|
||||
|
||||
/**
|
||||
* Set the {@link TargetFilterQuery}
|
||||
*
|
||||
* @param targetFilterQuery
|
||||
* for {@link Rollout#getTargetFilterQuery()}
|
||||
* @param targetFilterQuery for {@link Rollout#getTargetFilterQuery()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate targetFilterQuery(
|
||||
@@ -79,26 +75,23 @@ public interface RolloutCreate {
|
||||
/**
|
||||
* Set the {@link ActionType}
|
||||
*
|
||||
* @param actionType
|
||||
* for {@link Rollout#getActionType()}
|
||||
* @param actionType for {@link Rollout#getActionType()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate actionType(@NotNull ActionType actionType);
|
||||
|
||||
/**
|
||||
* Set the forcedTime of the resulting {@link Actions}
|
||||
* Set the forcedTime of the resulting {@link org.eclipse.hawkbit.repository.model.Action}s
|
||||
*
|
||||
* @param forcedTime
|
||||
* for {@link Rollout#getForcedTime()}
|
||||
* @param forcedTime for {@link Rollout#getForcedTime()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate forcedTime(Long forcedTime);
|
||||
|
||||
/**
|
||||
* Set the weight of the resulting {@link Actions}
|
||||
* Set the weight of the resulting {@link org.eclipse.hawkbit.repository.model.Action}s
|
||||
*
|
||||
* @param weight
|
||||
* for {@link Rollout#getWeight()}
|
||||
* @param weight for {@link Rollout#getWeight()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate weight(Integer weight);
|
||||
@@ -106,17 +99,15 @@ public interface RolloutCreate {
|
||||
/**
|
||||
* Set if the rollout shall be dynamic
|
||||
*
|
||||
* @param dynamic
|
||||
* for {@link Rollout#isDynamic()}
|
||||
* @param dynamic for {@link Rollout#isDynamic()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate dynamic(boolean dynamic);
|
||||
|
||||
/**
|
||||
* set start
|
||||
* Set start at
|
||||
*
|
||||
* @param startAt
|
||||
* for {@link Rollout#getStartAt()}
|
||||
* @param startAt for {@link Rollout#getStartAt()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutCreate startAt(Long startAt);
|
||||
@@ -125,4 +116,4 @@ public interface RolloutCreate {
|
||||
* @return peek on current state of {@link Rollout} in the builder
|
||||
*/
|
||||
Rollout build();
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,7 @@ public interface RolloutUpdate {
|
||||
/**
|
||||
* Set name of the {@link Rollout}
|
||||
*
|
||||
* @param name
|
||||
* for {@link Rollout#getName()}
|
||||
* @param name for {@link Rollout#getName()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutUpdate name(@Size(min = 1, max = NamedEntity.NAME_MAX_SIZE) @NotNull String name);
|
||||
@@ -35,54 +34,8 @@ public interface RolloutUpdate {
|
||||
/**
|
||||
* Set description of the {@link Rollout}
|
||||
*
|
||||
* @param description
|
||||
* for {@link Rollout#getDescription()}
|
||||
* @param description for {@link Rollout#getDescription()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutUpdate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
|
||||
|
||||
/**
|
||||
* Set ID of {@link DistributionSet} of the {@link Rollout}
|
||||
*
|
||||
* @param setId
|
||||
* for {@link Rollout#getDistributionSet()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutUpdate set(long setId);
|
||||
|
||||
/**
|
||||
* Set action type of the {@link Rollout}
|
||||
*
|
||||
* @param actionType
|
||||
* for {@link Rollout#getActionType()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutUpdate actionType(@NotNull Action.ActionType actionType);
|
||||
|
||||
/**
|
||||
* Set forcedTime of the {@link Rollout}
|
||||
*
|
||||
* @param forcedTime
|
||||
* for {@link Rollout#getForcedTime()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutUpdate forcedTime(Long forcedTime);
|
||||
|
||||
/**
|
||||
* Set weight of {@link Action}s created by the {@link Rollout}
|
||||
*
|
||||
* @param weight
|
||||
* for {@link Rollout#getWeight()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutUpdate weight(Integer weight);
|
||||
|
||||
/**
|
||||
* Set start time of the {@link Rollout}
|
||||
*
|
||||
* @param startAt
|
||||
* for {@link Rollout#getStartAt()}
|
||||
* @return updated builder instance
|
||||
*/
|
||||
RolloutUpdate startAt(Long startAt);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user