REST doc / Mgmt Target Filters - fix missed info (#1627)

When spring restdoc was replaces with swagger & open api some info was lost
This commit returns back this info for Mgmt API - TargetFilters

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-08 15:23:32 +02:00
committed by GitHub
parent 9afd847cc1
commit cb88d60226
3 changed files with 139 additions and 60 deletions

View File

@@ -31,35 +31,100 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(example = """
@Schema(description = """
**_links**:
* **type** - The type of the distribution set
* **modules** - List of software modules
* **metadata** - List of metadata
""", example = """
{
"createdBy" : "bumlux",
"createdAt" : 1682408575642,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408575643,
"name" : "DS",
"description" : "Updated Desc: 2LaONizh7WZp0on6XEOZI9AwEYIjj77YZskEmA2LVrKtAOXj9vvqACopEghLMqt6DIWpIahn6XM4jUlRZ1T5SZS2NWMuWHGoFIg1",
"version" : "1.0",
"modules" : [ {
"createdBy" : "bumlux",
"createdAt" : 1682408575640,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408575644,
"name" : "Firmware",
"description" : "Updated Desc: 2LaONizh7WZp0on6XEOZI9AwEYIjj77YZskEmA2LVrKtAOXj9vvqACopEghLMqt6DIWpIahn6XM4jUlRZ1T5SZS2NWMuWHGoFIg1",
"version" : "1.0.5",
"type" : "os",
"typeName" : "OS",
"vendor" : "vendor Limited Inc, California",
"deleted" : false,
"encrypted" : false,
"_links" : {
"self" : {
"href" : "https://management-api.host.com/rest/v1/softwaremodules/76"
}
},
"id" : 76
}""")
"createdBy" : "bumlux",
"createdAt" : 1682408574924,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408574925,
"name" : "DS",
"description" : "Updated Desc: 2LaONizh7WZp0on6XEOZI9AwEYIjj77YZskEmA2LVrKtAOXj9vvqACopEghLMqt6DIWpIahn6XM4jUlRZ1T5SZS2NWMuWHGoFIg1",
"version" : "1.0",
"modules" : [ {
"createdBy" : "bumlux",
"createdAt" : 1682408574921,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408574926,
"name" : "Firmware",
"description" : "Updated Desc: 2LaONizh7WZp0on6XEOZI9AwEYIjj77YZskEmA2LVrKtAOXj9vvqACopEghLMqt6DIWpIahn6XM4jUlRZ1T5SZS2NWMuWHGoFIg1",
"version" : "1.0.42",
"type" : "os",
"typeName" : "OS",
"vendor" : "vendor Limited Inc, California",
"deleted" : false,
"encrypted" : false,
"_links" : {
"self" : {
"href" : "https://management-api.host.com/rest/v1/softwaremodules/18"
}
},
"id" : 18
}, {
"createdBy" : "bumlux",
"createdAt" : 1682408574920,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408574925,
"name" : "app runtime",
"description" : "Updated Desc: 2LaONizh7WZp0on6XEOZI9AwEYIjj77YZskEmA2LVrKtAOXj9vvqACopEghLMqt6DIWpIahn6XM4jUlRZ1T5SZS2NWMuWHGoFIg1",
"version" : "1.0.25",
"type" : "runtime",
"typeName" : "runtime",
"vendor" : "vendor GmbH, Stuttgart, Germany",
"deleted" : false,
"encrypted" : false,
"_links" : {
"self" : {
"href" : "https://management-api.host.com/rest/v1/softwaremodules/17"
}
},
"id" : 17
}, {
"createdBy" : "bumlux",
"createdAt" : 1682408574919,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408574926,
"name" : "application",
"description" : "Updated Desc: 2LaONizh7WZp0on6XEOZI9AwEYIjj77YZskEmA2LVrKtAOXj9vvqACopEghLMqt6DIWpIahn6XM4jUlRZ1T5SZS2NWMuWHGoFIg1",
"version" : "1.0.67",
"type" : "application",
"typeName" : "Application",
"vendor" : "vendor Limited, California",
"deleted" : false,
"encrypted" : false,
"_links" : {
"self" : {
"href" : "https://management-api.host.com/rest/v1/softwaremodules/16"
}
},
"id" : 16
} ],
"requiredMigrationStep" : false,
"type" : "test_default_ds_type",
"typeName" : "OS (FW) mandatory, runtime (FW) and app (SW) optional",
"complete" : true,
"deleted" : false,
"valid" : true,
"_links" : {
"self" : {
"href" : "https://management-api.host.com/rest/v1/distributionsets/6"
},
"modules" : {
"href" : "https://management-api.host.com/rest/v1/distributionsets/6/assignedSM?offset=0&limit=50"
},
"type" : {
"href" : "https://management-api.host.com/rest/v1/distributionsettypes/24"
},
"metadata" : {
"href" : "https://management-api.host.com/rest/v1/distributionsets/6/metadata?offset=0&limit=50"
}
},
"id" : 6
}""")
public class MgmtDistributionSet extends MgmtNamedEntity {
@JsonProperty(value = "id", required = true)

View File

@@ -27,52 +27,59 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.ALWAYS)
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(example = """
@Schema(description = """
**_links**:
* **autoAssignDS** - Link to manage the auto assign distribution set
""", example = """
{
"createdBy" : "bumlux",
"createdAt" : 1682408575234,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408575234,
"name" : "filter1",
"query" : "name==a",
"autoAssignDistributionSet" : 16,
"autoAssignActionType" : null,
"autoAssignWeight" : null,
"confirmationRequired" : null,
"_links" : {
"self" : {
"href" : "https://management-api.host.com/rest/v1/targetfilters/2"
}
},
"id" : 2
}""")
"createdBy" : "bumlux",
"createdAt" : 1682408566380,
"lastModifiedBy" : "bumlux",
"lastModifiedAt" : 1682408566385,
"name" : "filter1",
"query" : "name==*",
"autoAssignDistributionSet" : 3,
"autoAssignActionType" : "forced",
"autoAssignWeight" : null,
"confirmationRequired" : null,
"_links" : {
"self" : {
"href" : "https://management-api.host.com/rest/v1/targetfilters/5"
},
"autoAssignDS" : {
"href" : "https://management-api.host.com/rest/v1/targetfilters/5/autoAssignDS"
}
},
"id" : 5
}""")
public class MgmtTargetFilterQuery extends MgmtBaseEntity {
@JsonProperty(value = "id", required = true)
@Schema(example = "2")
@Schema(description = "The technical identifier of the entity", example = "2")
private Long filterId;
@JsonProperty
@Schema(example = "filterName")
@Schema(description = "The name of the entity", example = "filterName")
private String name;
@JsonProperty
@Schema(example = "name==*")
@Schema(description = "Target filter query expression", example = "name==*")
private String query;
@JsonProperty
@Schema(example = "15")
private Long autoAssignDistributionSet;
@JsonProperty
@Schema(description = "Auto assign distribution set id")
private MgmtActionType autoAssignActionType;
@JsonProperty
@Schema(example = "")
@Schema(description = "Weight of the resulting Actions", example = "600")
private Integer autoAssignWeight;
@JsonProperty
@Schema(example = "false")
@Schema(description = "(Available with user consent flow active) Defines, if the confirmation is required for an " +
"action. Confirmation is required per default.", example = "false")
private Boolean confirmationRequired;
}

View File

@@ -47,7 +47,8 @@ public interface MgmtTargetFilterQueryRestApi {
* @return a single target with status OK.
*/
@Operation(summary = "Return target filter query by id", description = "Handles the GET request of retrieving a single target filter query. Required permission: READ_TARGET")
@Operation(summary = "Return target filter query by id", description = "Handles the GET request of retrieving a " +
"single target filter query. Required permission: READ_TARGET")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved"),
@ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters",
@@ -58,7 +59,8 @@ public interface MgmtTargetFilterQueryRestApi {
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 = "Target filter query not found.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", description = "Target filter query 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.",
@@ -299,7 +301,9 @@ public interface MgmtTargetFilterQueryRestApi {
* assignment
* @return http status
*/
@Operation(summary = "Set auto assignment of distribution set for a target filter query", description = "Handles the POST request of setting the auto assign distribution set for a target filter query. Required permissions: UPDATE_TARGET and READ_REPOSITORY")
@Operation(summary = "Set auto assignment of distribution set for a target filter query",
description = "Handles the POST request of setting the auto assign distribution set for a target filter " +
"query. Required permissions: UPDATE_TARGET and READ_REPOSITORY")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved"),
@ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters",
@@ -310,7 +314,8 @@ public interface MgmtTargetFilterQueryRestApi {
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 = "Target filter not found.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", description = "Target filter 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.",
@@ -339,7 +344,9 @@ public interface MgmtTargetFilterQueryRestApi {
* of the target to change
* @return http status
*/
@Operation(summary = "Remove Distribution Set for auto assignment of a target filter", description = "Removes the auto assign distribution set from the target filter query. Required permission: UPDATE_TARGET")
@Operation(summary = "Remove Distribution Set for auto assignment of a target filter",
description = "Removes the auto assign distribution set from the target filter query. " +
"Required permission: UPDATE_TARGET")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved"),
@ApiResponse(responseCode = "400", description = "Bad Request - e.g. invalid parameters",
@@ -350,7 +357,8 @@ public interface MgmtTargetFilterQueryRestApi {
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 = "Target filter query not found.", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", description = "Target filter query 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.",
@@ -361,5 +369,4 @@ public interface MgmtTargetFilterQueryRestApi {
})
@DeleteMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}/autoAssignDS")
ResponseEntity<Void> deleteAssignedDistributionSet(@PathVariable("filterId") Long filterId);
}
}