From 8fb6d1ab5acfa2d01134aad07f2a71083b670101 Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Thu, 8 Feb 2024 17:15:07 +0200 Subject: [PATCH] REST doc / Mgmt Tenant - fix missed info (#1631) When spring restdoc was replaces with swagger & open api some info was lost This commit returns back this info for Mgmt API - Tenant Signed-off-by: Marinov Avgustin --- .../MgmtSystemTenantConfigurationValue.java | 68 +++++++++++++------ ...SystemTenantConfigurationValueRequest.java | 11 +-- .../rest/api/MgmtTenantManagementRestApi.java | 27 +++++--- 3 files changed, 74 insertions(+), 32 deletions(-) diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java index f6aeeb99c..0361691c1 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java @@ -30,29 +30,59 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) +@Schema(description = """ + **properties**: + * **rollout.approval.enabled** - Boolean, The configuration key 'rollout.approval.enabled' defines if + approval mode for Rollout Management is enabled. + * **repository.actions.autoclose.enabled** - Boolean, The configuration key 'repository.actions.autoclose.enabled' defines if autoclose running actions with new Distribution Set assignment is enabled. + * **user.confirmation.flow.enabled** - Boolean, The configuration key 'user.confirmation.flow.enabled' defines if confirmation is required when distribution set is assigned to target. + * **authentication.gatewaytoken.enabled** - Boolean, The configuration key 'authentication.gatewaytoken.enabled' defines if the authentication mode 'gateway security token' is enabled. + * **action.cleanup.enabled** - Boolean, The configuration key 'action.cleanup.enabled' defines if automatic cleanup of deployment actions is enabled. + * **action.cleanup.actionExpiry** - Long, The configuration key 'action.cleanup.actionExpiry' defines the expiry time in milliseconds that needs to elapse before an action may be cleaned up. + * **authentication.header.enabled** - Boolean, The configuration key 'authentication.header.enabled' defines if the authentication mode 'authority header' is enabled. + * **maintenanceWindowPollCount** - Integer, The configuration key 'maintenanceWindowPollCount' defines the polling interval so that controller tries to poll at least these many times between the last polling and before start of maintenance window. The polling interval is bounded by configured pollingTime and minPollingTime. The polling interval is modified as per following scheme: pollingTime(@time=t) = (maintenanceWindowStartTime - t)/maintenanceWindowPollCount. + * **authentication.targettoken.enabled** - Boolean, The configuration key 'authentication.targettoken.enabled' defines if the authentication mode 'target security token' is enabled. + * **pollingTime** - String, The configuration key 'pollingTime' defines the time interval between two poll requests of a target. + * **anonymous.download.enabled** - Boolean, The configuration key 'anonymous.download.enabled' defines if the anonymous download mode is enabled. + * **authentication.header.authority** - String, The configuration key 'authentication.header.authority' defines the name of the 'authority header'. + * **minPollingTime** - String, The configuration key 'minPollingTime' defines the smallest time interval permitted between two poll requests of a target. + * **authentication.gatewaytoken.key** - String, The configuration key 'authentication.gatewaytoken.key' defines the key of the gateway security token. + * **action.cleanup.actionStatus** - String, The configuration key 'action.cleanup.actionStatus' defines the list of action status that should be taken into account for the cleanup. + * **pollingOverdueTime** - String, The configuration key 'pollingOverdueTime' defines the period of time after the SP server will recognize a target, which is not performing pull requests anymore. + * **multi.assignments.enabled** - Boolean, The configuration key 'multi.assignments.enabled' defines if multiple distribution sets can be assigned to the same targets. + * **batch.assignments.enabled** - Boolean, The configuration key 'batch.assignments.enabled' defines if distribution set can be assigned to multiple targets in a single batch message. + """, example = """ + { + "value" : "", + "global" : true, + "_links" : { + "self" : { + "href" : "https://management-api.host.com/rest/v1/system/configs/authentication.gatewaytoken.key" + } + } + }""") public class MgmtSystemTenantConfigurationValue extends RepresentationModel { - @JsonInclude(Include.ALWAYS) - @Schema(example = "true") + @JsonInclude + @Schema(description = "Current value of of configuration parameter", example = "true") private Object value; - @JsonInclude(Include.ALWAYS) - @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) - @Schema(example = "true") - private boolean isGlobal = true; - @Schema(example = "1623085150") + + @JsonInclude + @Schema(description = "true - if the current value is the global configuration value, false - if there is a " + + "tenant specific value configured", example = "true") + private boolean global = true; + + @Schema(description = "Entity was last modified at (timestamp UTC in milliseconds)", example = "1623085150") private Long lastModifiedAt; - @Schema(example = "example user") + + @Schema(description = "Entity was last modified by (User, AMQP-Controller, anonymous etc.)", + example = "example user") private String lastModifiedBy; - @Schema(example = "1523085150") + + @Schema(description = "Entity was originally created at (timestamp UTC in milliseconds)", example = "1523085150") private Long createdAt; - @Schema(example = "example user") + + @Schema(description = "Entity was originally created by (User, AMQP-Controller, anonymous etc.)", + example = "example user") private String createdBy; - - public boolean isGlobal() { - return isGlobal; - } - - public void setGlobal(final boolean isGlobal) { - this.isGlobal = isGlobal; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValueRequest.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValueRequest.java index 9b578512c..12f86857d 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValueRequest.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValueRequest.java @@ -16,25 +16,28 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.ToString; /** * A json annotated rest model for System Configuration for PUT. */ +@Getter +@EqualsAndHashCode +@ToString @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSystemTenantConfigurationValueRequest { - @Getter @JsonProperty(required = true) - @Schema(example = "exampleToken") + @Schema(description = "Current value of of configuration parameter", example = "exampleToken") private Serializable value; - public void setValue(final Object value) { if (!(value instanceof Serializable)) { throw new IllegalArgumentException("The value must be a instance of " + Serializable.class.getName()); } this.value = (Serializable) value; } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java index 42d27a7cf..47b44fbc3 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTenantManagementRestApi.java @@ -44,7 +44,8 @@ public interface MgmtTenantManagementRestApi { * * @return a map of all configuration values. */ - @Operation(summary = "Return all tenant specific configuration values", description = "The GET request returns a list of all possible configuration keys for the tenant. Required Permission: TENANT_CONFIGURATION") + @Operation(summary = "Return all tenant specific configuration values", description = "The GET request returns " + + "a list of all possible configuration keys for the tenant. Required Permission: TENANT_CONFIGURATION") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", @@ -77,7 +78,9 @@ public interface MgmtTenantManagementRestApi { * OK. In any failure the JsonResponseExceptionHandler is handling * the response. */ - @Operation(summary = "Delete a tenant specific configuration value", description = "The DELETE request removes a tenant specific configuration value for the tenant. Afterwards the global default value is used. Required Permission: TENANT_CONFIGURATION") + @Operation(summary = "Delete a tenant specific configuration value", description = "The DELETE request removes a " + + "tenant specific configuration value for the tenant. Afterwards the global default value is used. " + + "Required Permission: TENANT_CONFIGURATION") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", @@ -110,7 +113,9 @@ public interface MgmtTenantManagementRestApi { * In any failure the JsonResponseExceptionHandler is handling the * response. */ - @Operation(summary = "Return a tenant specific configuration value", description = "The GET request returns the configuration value of a specific configuration key for the tenant. Required Permission: TENANT_CONFIGURATION") + @Operation(summary = "Return a tenant specific configuration value", description = "The GET request returns the " + + "configuration value of a specific configuration key for the tenant. " + + "Required Permission: TENANT_CONFIGURATION") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", @@ -121,7 +126,8 @@ public interface MgmtTenantManagementRestApi { description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or " + "data volume restriction applies.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Configuration key not found.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Configuration key not found.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", @@ -147,7 +153,9 @@ public interface MgmtTenantManagementRestApi { * In any failure the JsonResponseExceptionHandler is handling the * response. */ - @Operation(summary = "Update a tenant specific configuration value.", description = "The PUT request changes a configuration value of a specific configuration key for the tenant. Required Permission: TENANT_CONFIGURATION") + @Operation(summary = "Update a tenant specific configuration value.", description = "The PUT request changes a " + + "configuration value of a specific configuration key for the tenant. " + + "Required Permission: TENANT_CONFIGURATION") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", @@ -158,7 +166,8 @@ public interface MgmtTenantManagementRestApi { description = "Insufficient permissions, entity is not allowed to be changed (i.e. read-only) or " + "data volume restriction applies.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Configuration key not found.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Configuration key not found.", + content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), @ApiResponse(responseCode = "405", description = "The http request method is not allowed on the resource.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))), @ApiResponse(responseCode = "406", description = "In case accept header is specified and not application/json.", @@ -189,7 +198,8 @@ public interface MgmtTenantManagementRestApi { * In any failure the JsonResponseExceptionHandler is handling the * response. */ - @Operation(summary = "Batch update of tenant configuration.", description = "The PUT request updates the whole configuration for the tenant. Required Permission: TENANT_CONFIGURATION") + @Operation(summary = "Batch update of tenant configuration.", description = "The PUT request updates the whole " + + "configuration for the tenant. Required Permission: TENANT_CONFIGURATION") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully retrieved"), @ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters", @@ -219,5 +229,4 @@ public interface MgmtTenantManagementRestApi { MediaType.APPLICATION_JSON_VALUE }) ResponseEntity> updateTenantConfiguration( @RequestBody Map configurationValueMap); - -} +} \ No newline at end of file