diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentRequestBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentRequestBody.java index 986349738..202b6d2c0 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentRequestBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtTargetAssignmentRequestBody.java @@ -34,7 +34,7 @@ public class MgmtTargetAssignmentRequestBody { private MgmtActionType type; @Schema(description = "Separation of download and install by defining a maintenance window for the installation") private MgmtMaintenanceWindowRequestBody maintenanceWindow; - @Schema(description = "Importance of the assignment. Allowed values: 0 - 1000", example = "100") + @Schema(description = "Importance of the assignment", example = "100") private Integer weight; @Schema(description = "(Available with user consent flow active) Defines, if the confirmation is required for " + "an action. Confirmation is required per default") diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java index 4a65de363..ca84fa440 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java @@ -27,8 +27,7 @@ import org.eclipse.hawkbit.mgmt.json.model.MgmtTypeEntity; @EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -@Schema( - description = """ +@Schema(description = """ **_links**: * **mandatorymodules** - Link to mandatory software modules types in this distribution set type * **optionalmodules** - Link to optional software modules types in this distribution set type diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java index 0d42e3ad2..5a71885bf 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java @@ -9,6 +9,7 @@ */ package org.eclipse.hawkbit.mgmt.json.model.rollout; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity; @@ -25,8 +26,16 @@ import com.fasterxml.jackson.annotation.JsonInclude; @JsonIgnoreProperties(ignoreUnknown = true) public abstract class AbstractMgmtRolloutConditionsEntity extends MgmtNamedEntity { + @Schema(description = "The success condition which takes in place to evaluate if a rollout group is successful " + + "and so the next group can be started") private MgmtRolloutCondition successCondition; + + @Schema(description = "The success action which takes in place to execute in case the success action is fulfilled") private MgmtRolloutSuccessAction successAction; + + @Schema(description = "The error condition which takes in place to evaluate if a rollout group encounter errors") private MgmtRolloutCondition errorCondition; + + @Schema(description = "The error action which is executed if the error condition is fulfilled") private MgmtRolloutErrorAction errorAction; -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java index 0e16f470d..1b8cb6bb3 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java @@ -26,12 +26,14 @@ public class MgmtRolloutCondition { THRESHOLD } + @Schema(description = "The type of the condition") private Condition condition = Condition.THRESHOLD; - @Schema(example = "50") + @Schema(description = "The expression according to the condition, e.g. the value of threshold in percentage", + example = "50") private String expression = "100"; public MgmtRolloutCondition(final Condition condition, final String expression) { this.condition = condition; this.expression = expression; } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java index 2bc4d4695..48539c647 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java @@ -29,8 +29,9 @@ public class MgmtRolloutErrorAction { PAUSE } + @Schema(description = "The error action to execute") private ErrorAction action = ErrorAction.PAUSE; - @Schema(example = "80") + @Schema(description = "The expression for the error action", example = "80") private String expression; /** diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java index 73249c5c3..254e2d9e6 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java @@ -29,47 +29,130 @@ import com.fasterxml.jackson.annotation.JsonProperty; @EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) +@Schema(description = """ + **_links**: + * **start** - Link to start the rollout in sync mode + * **pause** - Link to pause a running rollout + * **triggerNextGroup** - Link for triggering next rollout group on a running rollout + * **resume** - Link to resume a paused rollout + * **groups** - Link to retrieve the groups a rollout + * **approve** - Link to approve a rollout + * **deny** - Link to deny a rollout + * **distributionset** - The link to the distribution set + """, example = """ + { + "createdBy" : "bumlux", + "createdAt" : 1682408568812, + "lastModifiedBy" : "bumlux", + "lastModifiedAt" : 1682408568812, + "name" : "exampleRollout", + "description" : "Rollout for all named targets", + "targetFilterQuery" : "id==targets-*", + "distributionSetId" : 6, + "status" : "creating", + "totalTargets" : 20, + "totalTargetsPerStatus" : { + "running" : 0, + "notstarted" : 20, + "scheduled" : 0, + "cancelled" : 0, + "finished" : 0, + "error" : 0 + }, + "totalGroups" : 5, + "startAt" : 1682408570791, + "forcetime" : 1682408571791, + "deleted" : false, + "type" : "forced", + "_links" : { + "start" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6/start" + }, + "pause" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6/pause" + }, + "resume" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6/resume" + }, + "triggerNextGroup" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6/triggerNextGroup" + }, + "approve" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6/approve" + }, + "deny" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6/deny" + }, + "groups" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6/deploygroups?offset=0&limit=50" + }, + "distributionset" : { + "href" : "https://management-api.host.com/rest/v1/distributionsets/6", + "name" : "bd3a71cb-6c8f-445c-adbb-e221414dcd96:1.0" + }, + "self" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/6" + } + }, + "id" : 6 + }""") public class MgmtRolloutResponseBody extends MgmtNamedEntity { - @Schema(example = "controllerId==exampleTarget*") + @Schema(description = "Target filter query language expression", example = "controllerId==exampleTarget*") private String targetFilterQuery; - @Schema(example = "2") + + @Schema(description = "The ID of distribution set of this rollout", example = "2") private Long distributionSetId; + @JsonProperty(value = "id", required = true) - @Schema(example = "2") + @Schema(description = "Rollout id", example = "2") private Long rolloutId; + @JsonProperty(required = true) - @Schema(example = "ready") + @Schema(description = "The status of this rollout", example = "ready") private String status; + @JsonProperty(required = true) - @Schema(example = "20") + @Schema(description = "The total targets of a rollout", example = "20") private Long totalTargets; + @Setter(AccessLevel.NONE) @JsonProperty + @Schema(description = "The total targets per status") private Map totalTargetsPerStatus; + @JsonProperty - @Schema(example = "5") + @Schema(description = "The total number of groups created by this rollout", example = "5") private Integer totalGroups; + @JsonProperty - @Schema(example = "1691065753136") + @Schema(description = "Start at timestamp of Rollout", example = "1691065753136") private Long startAt; + @JsonProperty - @Schema(example = "1691065762496") + @Schema(description = "Forcetime in milliseconds", example = "1691065762496") private Long forcetime; + @JsonProperty - @Schema(example = "false") + @Schema(description = "Deleted flag, used for soft deleted entities", example = "false") private boolean deleted; + @JsonProperty + @Schema(description = "The type of this rollout") private MgmtActionType type; + @JsonProperty - @Schema(example = "400") + @Schema(description = "Weight of the resulting Actions", example = "400") private Integer weight; + @JsonProperty - @Schema(example = "true") + @Schema(description = "If this rollout is dynamic or static", example = "true") private boolean dynamic; + @JsonProperty @Schema(example = "Approved remark.") private String approvalRemark; + @JsonProperty @Schema(example = "exampleUsername") private String approveDecidedBy; @@ -81,4 +164,4 @@ public class MgmtRolloutResponseBody extends MgmtNamedEntity { totalTargetsPerStatus.put(status, totalTargetCountByStatus); } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java index d9e43f0f3..ba2cd7749 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java @@ -31,27 +31,69 @@ import com.fasterxml.jackson.annotation.JsonProperty; @EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) +@Schema(example = """ + { + "distributionSetId" : 6, + "targetFilterQuery" : "id==targets-*", + "description" : "Rollout for all named targets", + "amountGroups" : 5, + "type" : "forced", + "successCondition" : { + "condition" : "THRESHOLD", + "expression" : "50" + }, + "successAction" : { + "expression" : "", + "action" : "NEXTGROUP" + }, + "name" : "exampleRollout", + "forcetime" : 1682408571791, + "errorAction" : { + "expression" : "", + "action" : "PAUSE" + }, + "confirmationRequired" : false, + "errorCondition" : { + "condition" : "THRESHOLD", + "expression" : "80" + }, + "startAt" : 1682408570791 + }""") public class MgmtRolloutRestRequestBody extends AbstractMgmtRolloutConditionsEntity { - @Schema(example = "id==targets-*") + @Schema(description = "Target filter query language expression", example = "id==targets-*") private String targetFilterQuery; - @Schema(example = "6") + + @Schema(description = "The ID of distributionset of this rollout", example = "6") private long distributionSetId; - @Schema(example = "5") + + @Schema(description = "The amount of groups the rollout should split targets into", example = "5") private Integer amountGroups; - @Schema(example = "1691065781929") + + @Schema(description = "Forcetime in milliseconds", example = "1691065781929") private Long forcetime; - @Schema(example = "1691065780929") + + @Schema(description = "Start at timestamp of Rollout", example = "1691065780929") private Long startAt; + @JsonProperty - @Schema(example = "400") + @Schema(description = "Weight of the resulting Actions", example = "400") private Integer weight; + @JsonProperty @Schema(example = "true") private boolean dynamic; + @JsonProperty - @Schema(example = "false") + @Schema(description = """ + (Available with user consent flow active) If the confirmation is required for this rollout. Value will be used + if confirmation options are missing in the rollout group definitions. Confirmation is required per default""", + example = "false") private Boolean confirmationRequired; + + @Schema(description = "The type of this rollout") private MgmtActionType type; + + @Schema(description = "The list of group definitions") private List groups; -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java index f8b89f3ff..304640d26 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java @@ -12,6 +12,7 @@ package org.eclipse.hawkbit.mgmt.json.model.rollout; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.NoArgsConstructor; @@ -25,8 +26,10 @@ public class MgmtRolloutSuccessAction { NEXTGROUP } + @Schema(description = "The success action to execute") private SuccessAction action = SuccessAction.NEXTGROUP; - private String expression = null; + @Schema(description = "The expression for the success action") + private String expression; public MgmtRolloutSuccessAction(final SuccessAction action, final String expression) { this.action = action; diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java index bf23dfa63..f96fd8122 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java @@ -26,10 +26,14 @@ import com.fasterxml.jackson.annotation.JsonInclude; @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutGroup extends AbstractMgmtRolloutConditionsEntity { - @Schema(example = "controllerId==exampleTarget*") + @Schema(description = "The name of the entity", example = "controllerId==exampleTarget*") private String targetFilterQuery; - @Schema(example = "20.0") + + @Schema(description = "Percentage of remaining and matching targets that should be added to this group", + example = "20.0") private Float targetPercentage; - @Schema(example = "false") + + @Schema(description = "(Available with user consent flow active) If the confirmation is required for this " + + "rollout group. Confirmation is required per default", example = "false") private Boolean confirmationRequired; } \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java index 7b8f5d3f9..953c40d8b 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java @@ -30,17 +30,65 @@ import lombok.Setter; @EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) +@Schema(example = """ + { + "createdBy" : "bumlux", + "createdAt" : 1682408569768, + "lastModifiedBy" : "bumlux", + "lastModifiedAt" : 1682408569795, + "name" : "group-1", + "description" : "group-1", + "successCondition" : { + "condition" : "THRESHOLD", + "expression" : "10" + }, + "successAction" : { + "action" : "NEXTGROUP", + "expression" : "" + }, + "errorCondition" : { + "condition" : "THRESHOLD", + "expression" : "50" + }, + "errorAction" : { + "action" : "PAUSE", + "expression" : "" + }, + "targetFilterQuery" : "", + "targetPercentage" : 20.0, + "confirmationRequired" : false, + "status" : "ready", + "totalTargets" : 4, + "totalTargetsPerStatus" : { + "running" : 0, + "notstarted" : 4, + "scheduled" : 0, + "cancelled" : 0, + "finished" : 0, + "error" : 0 + }, + "_links" : { + "self" : { + "href" : "https://management-api.host.com/rest/v1/rollouts/17/deploygroups/78" + } + }, + "id" : 78 + }""") public class MgmtRolloutGroupResponseBody extends MgmtRolloutGroup { @JsonProperty(value = "id", required = true) - @Schema(example = "63") + @Schema(description = "Rollouts id", example = "63") private Long rolloutGroupId; + @JsonProperty(required = true) - @Schema(example = "ready") + @Schema(description = "The status of this rollout", example = "ready") private String status; - @Schema(example = "4") + + @Schema(description = "The total targets of a rollout", example = "4") private int totalTargets; + @Setter(AccessLevel.NONE) + @Schema(description = "The total targets per status") private Map totalTargetsPerStatus; public void addTotalTargetsPerStatus(final String status, final Long totalTargetCountByStatus) { diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java index 9d6598e38..1b35949d8 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java @@ -27,8 +27,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -@Schema( - description = """ +@Schema(description = """ **_links**: * **assignedDistributionSets** - Links to assigned distribution sets """, example = """