Skip to content

Commit

Permalink
Add REST method for update rollout
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
avgustinmm committed Jun 20, 2024
1 parent b42765b commit c17fef5
Show file tree
Hide file tree
Showing 20 changed files with 321 additions and 343 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@

/**
* 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);
Expand All @@ -28,5 +26,4 @@ public interface RolloutBuilder {
* @return builder instance
*/
RolloutCreate create();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,45 @@
*
*/
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);

/**
* 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);

/**
* 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(
Expand All @@ -79,44 +75,39 @@ RolloutCreate targetFilterQuery(
/**
* 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);

/**
* 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);
Expand All @@ -125,4 +116,4 @@ RolloutCreate targetFilterQuery(
* @return peek on current state of {@link Rollout} in the builder
*/
Rollout build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,63 +26,16 @@ 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);

/**
* 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);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Update implementation.
*/
public class GenericRolloutUpdate extends AbstractRolloutUpdateCreate<RolloutUpdate> implements RolloutUpdate {
public class GenericRolloutUpdate extends AbstractNamedEntityBuilder<RolloutUpdate> implements RolloutUpdate {

public GenericRolloutUpdate(final Long id) {
super.id = id;
Expand Down
Loading

0 comments on commit c17fef5

Please sign in to comment.