Skip to content

Commit

Permalink
REST doc / Mgmt Tenant - fix missed info (#1631)
Browse files Browse the repository at this point in the history
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 <Avgustin.Marinov@bosch.com>
  • Loading branch information
avgustinmm authored Feb 8, 2024
1 parent 5d24142 commit 8fb6d1a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,59 @@
@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<MgmtSystemTenantConfigurationValue> {

@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")
private Long createdAt;
@Schema(example = "example user")
private String createdBy;

public boolean isGlobal() {
return isGlobal;
}
@Schema(description = "Entity was originally created at (timestamp UTC in milliseconds)", example = "1523085150")
private Long createdAt;

public void setGlobal(final boolean isGlobal) {
this.isGlobal = isGlobal;
}
}
@Schema(description = "Entity was originally created by (User, AMQP-Controller, anonymous etc.)",
example = "example user")
private String createdBy;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,28 @@
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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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.",
Expand All @@ -147,7 +153,9 @@ ResponseEntity<MgmtSystemTenantConfigurationValue> getTenantConfigurationValue(
* 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",
Expand All @@ -158,7 +166,8 @@ ResponseEntity<MgmtSystemTenantConfigurationValue> getTenantConfigurationValue(
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.",
Expand Down Expand Up @@ -189,7 +198,8 @@ ResponseEntity<MgmtSystemTenantConfigurationValue> updateTenantConfigurationValu
* 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",
Expand Down Expand Up @@ -219,5 +229,4 @@ ResponseEntity<MgmtSystemTenantConfigurationValue> updateTenantConfigurationValu
MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<List<MgmtSystemTenantConfigurationValue>> updateTenantConfiguration(
@RequestBody Map<String, Serializable> configurationValueMap);

}
}

0 comments on commit 8fb6d1a

Please sign in to comment.