This is an automated email from the ASF dual-hosted git repository.
apkhmv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 6a66d32ca6 IGNITE-19192 Bump OpenAPI generator version (#1896)
6a66d32ca6 is described below
commit 6a66d32ca6e86e1aab596d6bff92699b252ba0b7
Author: Mikhail <[email protected]>
AuthorDate: Fri Apr 14 13:10:21 2023 +0300
IGNITE-19192 Bump OpenAPI generator version (#1896)
---
gradle/libs.versions.toml | 4 +-
modules/rest-api/openapi/openapi.properties | 3 +-
modules/rest-api/openapi/openapi.yaml | 122 ++++++++++-----------
.../ignite/internal/rest/api/InvalidParam.java | 5 +-
.../rest/api/cluster/ClusterManagementApi.java | 9 +-
.../{ClusterNodeDto.java => ClusterNode.java} | 22 ++--
.../{ClusterStateDto.java => ClusterState.java} | 23 ++--
.../{ClusterTagDto.java => ClusterTag.java} | 16 ++-
.../internal/rest/api/cluster/InitCommand.java | 17 +--
...{NetworkAddressDto.java => NetworkAddress.java} | 9 +-
.../{NodeMetadataDto.java => NodeMetadata.java} | 11 +-
.../internal/rest/api/cluster/TopologyApi.java | 16 +--
...ionConfigDto.java => AuthenticationConfig.java} | 13 +--
...gDto.java => AuthenticationProviderConfig.java} | 13 +--
...java => BasicAuthenticationProviderConfig.java} | 5 +-
.../api/configuration/ClusterConfigurationApi.java | 23 ++--
.../api/configuration/NodeConfigurationApi.java | 21 +---
.../rest/api/deployment/DeploymentCodeApi.java | 87 +++++----------
.../{UnitStatusDto.java => UnitStatus.java} | 9 +-
.../api/metric/{MetricDto.java => Metric.java} | 10 +-
.../metric/{MetricSetDto.java => MetricSet.java} | 22 ++--
.../{MetricSourceDto.java => MetricSource.java} | 13 ++-
.../internal/rest/api/metric/NodeMetricApi.java | 14 ++-
.../internal/rest/api/node/NodeManagementApi.java | 9 +-
.../ignite/internal/rest/api/node/NodeState.java | 13 ++-
.../ignite/internal/rest/constants/MediaType.java | 5 +-
.../cluster/ItClusterManagementControllerTest.java | 8 +-
.../DeploymentManagementControllerTest.java | 10 +-
.../rest/cluster/ClusterManagementController.java | 39 +++----
.../internal/rest/cluster/TopologyController.java | 29 +++--
.../deployment/DeploymentManagementController.java | 13 +--
.../rest/metrics/NodeMetricController.java | 18 +--
32 files changed, 291 insertions(+), 340 deletions(-)
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 6f20cf8379..1eb2a551ac 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -44,7 +44,7 @@ mockito = "4.3.1"
picocli = "4.7.0"
slf4j = "1.7.32"
spoon = "8.4.0-beta-18"
-swagger = "2.1.12"
+swagger = "2.2.8"
swaggerLegacy = "1.6.4"
typesafe = "1.4.1"
hamcrest = "2.2"
@@ -71,7 +71,7 @@ bytebuddy = "1.12.8"
mockServer = "5.13.2"
archunit = "1.0.1"
testkit = "1.8.2"
-openapi = "3.2.0"
+openapi = "4.8.6"
autoService = "1.0.1"
awaitility = "4.2.0"
progressBar = "0.9.4"
diff --git a/modules/rest-api/openapi/openapi.properties
b/modules/rest-api/openapi/openapi.properties
index 26baef5ac0..c8ca41831a 100644
--- a/modules/rest-api/openapi/openapi.properties
+++ b/modules/rest-api/openapi/openapi.properties
@@ -15,5 +15,6 @@
# limitations under the License.
#
-micronaut.openapi.property.naming.strategy=CAMEL_CASE
+micronaut.openapi.property.naming.strategy=LOWER_CAMEL_CASE
micronaut.openapi.target.file=openapi/openapi.yaml
+micronaut.openapi.field.visibility.level=PRIVATE
diff --git a/modules/rest-api/openapi/openapi.yaml
b/modules/rest-api/openapi/openapi.yaml
index 3556a737d9..55b668e17a 100644
--- a/modules/rest-api/openapi/openapi.yaml
+++ b/modules/rest-api/openapi/openapi.yaml
@@ -12,9 +12,9 @@ paths:
post:
tags:
- clusterManagement
+ summary: Initializes cluster.
description: Initializes a new cluster.
operationId: init
- parameters: []
requestBody:
content:
application/json:
@@ -44,9 +44,9 @@ paths:
get:
tags:
- clusterManagement
+ summary: Returns cluster state.
description: Returns current cluster status.
operationId: clusterState
- parameters: []
responses:
"200":
description: Cluster status returned.
@@ -71,9 +71,9 @@ paths:
get:
tags:
- topology
+ summary: Cluster logical topology.
description: Gets information about logical cluster topology.
operationId: logical
- parameters: []
responses:
"200":
description: Logical topology returned.
@@ -100,9 +100,9 @@ paths:
get:
tags:
- topology
+ summary: Cluster physical topology.
description: Gets information about physical cluster topology.
operationId: physical
- parameters: []
responses:
"200":
description: Physical topology returned.
@@ -122,9 +122,9 @@ paths:
get:
tags:
- clusterConfiguration
+ summary: Returns cluster configuration in HOCON format.
description: Gets the current configuration of the cluster.
operationId: getClusterConfiguration
- parameters: []
responses:
"200":
description: Received cluster configuration.
@@ -153,10 +153,10 @@ paths:
patch:
tags:
- clusterConfiguration
+ summary: Updates cluster configuration in HOCON format.
description: Updates cluster configuration. New configuration should be
provided
in HOCON format.
operationId: updateClusterConfiguration
- parameters: []
requestBody:
description: The cluster configuration to update.
content:
@@ -168,7 +168,7 @@ paths:
"200":
description: Configuration updated.
content:
- application/problem+json:
+ application/json:
schema:
$ref: '#/components/schemas/Void'
"500":
@@ -193,6 +193,7 @@ paths:
get:
tags:
- clusterConfiguration
+ summary: Returns configuration in HOCON format represented by path.
description: Gets the configuration on the specific path. Configuration
is in
HOCON format
operationId: getClusterConfigurationByPath
@@ -232,9 +233,9 @@ paths:
get:
tags:
- nodeConfiguration
+ summary: Returns node configuration in HOCON format.
description: Gets node configuration in HOCON format.
operationId: getNodeConfiguration
- parameters: []
responses:
"200":
description: Full node configuration.
@@ -257,10 +258,10 @@ paths:
patch:
tags:
- nodeConfiguration
+ summary: Updates node configuration in HOCON format.
description: Updates node configuration. New configuration should be
provided
in HOCON format.
operationId: updateNodeConfiguration
- parameters: []
requestBody:
description: The node configuration to update.
content:
@@ -272,7 +273,7 @@ paths:
"200":
description: Configuration successfully updated.
content:
- application/problem+json:
+ application/json:
schema:
$ref: '#/components/schemas/Void'
"500":
@@ -291,6 +292,7 @@ paths:
get:
tags:
- nodeConfiguration
+ summary: Returns configuration in HOCON format represented by path.
description: "Gets a configuration of a specific node, in HOCON format."
operationId: getNodeConfigurationByPath
parameters:
@@ -323,9 +325,9 @@ paths:
get:
tags:
- deployment
+ summary: All units status REST method.
description: All units statuses.
operationId: units
- parameters: []
responses:
"200":
description: All statuses returned successfully.
@@ -344,9 +346,9 @@ paths:
post:
tags:
- deployment
+ summary: Deploy unit REST method.
description: Deploys provided unit to the cluster.
operationId: deployUnit
- parameters: []
requestBody:
content:
multipart/form-data:
@@ -357,16 +359,12 @@ paths:
type: object
properties:
unitId:
- required:
- - "true"
type: string
description: The ID of the deployment unit.
unitVersion:
type: string
description: The version of the deployment unit.
unitContent:
- required:
- - "true"
type: string
description: The code to deploy.
format: binary
@@ -394,6 +392,7 @@ paths:
get:
tags:
- deployment
+ summary: Find unit by node consistent id.
description: Returns the status of units that are deployed on the node.
operationId: byConsistentId
parameters:
@@ -401,8 +400,6 @@ paths:
in: path
required: true
schema:
- required:
- - "true"
type: string
description: The consistent deployment unit identifier.
responses:
@@ -424,6 +421,7 @@ paths:
delete:
tags:
- deployment
+ summary: Undeploy latest unit REST method.
description: Undeploys the latest unit with the provided unitId.
operationId: undeployLatestUnit
parameters:
@@ -431,8 +429,6 @@ paths:
in: path
required: true
schema:
- required:
- - "true"
type: string
description: The ID of the deployment unit.
responses:
@@ -458,6 +454,7 @@ paths:
get:
tags:
- deployment
+ summary: Unit status REST method.
description: Returns the status of the unit with the provided identifier.
operationId: status
parameters:
@@ -465,8 +462,6 @@ paths:
in: path
required: true
schema:
- required:
- - "true"
type: string
description: The ID of the deployment unit.
responses:
@@ -492,6 +487,7 @@ paths:
get:
tags:
- deployment
+ summary: Versions of unit REST method.
description: Returns all versions of the unit with the provided unit
identifier.
operationId: versions
parameters:
@@ -499,8 +495,6 @@ paths:
in: path
required: true
schema:
- required:
- - "true"
type: string
description: The ID of the deployment unit.
responses:
@@ -528,6 +522,7 @@ paths:
delete:
tags:
- deployment
+ summary: Undeploy unit REST method.
description: Undeploys the unit with provided unitId and unitVersion.
operationId: undeployUnit
parameters:
@@ -535,16 +530,12 @@ paths:
in: path
required: true
schema:
- required:
- - "true"
type: string
description: The ID of the deployment unit.
- name: unitVersion
in: path
required: true
schema:
- required:
- - "true"
type: string
description: The version of the deployment unit.
responses:
@@ -570,9 +561,9 @@ paths:
post:
tags:
- nodeMetric
+ summary: Disable metric source.
description: Disables the specified metric source.
operationId: disableNodeMetric
- parameters: []
requestBody:
content:
text/plain:
@@ -598,9 +589,9 @@ paths:
post:
tags:
- nodeMetric
+ summary: Enable metric source.
description: Enables the specified metric source.
operationId: enableNodeMetric
- parameters: []
requestBody:
content:
text/plain:
@@ -626,9 +617,9 @@ paths:
get:
tags:
- nodeMetric
+ summary: List metric sets.
description: Gets a list of all enabled metric sets.
operationId: listNodeMetricSets
- parameters: []
responses:
"200":
description: Returned a list of metric sets.
@@ -648,9 +639,9 @@ paths:
get:
tags:
- nodeMetric
+ summary: List metric sources.
description: Gets a list of all available metric sources.
operationId: listNodeMetricSources
- parameters: []
responses:
"200":
description: Returned a list of metric sources.
@@ -672,7 +663,6 @@ paths:
- nodeManagement
description: Gets current network status.
operationId: nodeState
- parameters: []
responses:
"200":
description: Current node status.
@@ -692,7 +682,6 @@ paths:
- nodeManagement
description: Gets the version of Apache Ignite the node uses.
operationId: nodeVersion
- parameters: []
responses:
"200":
description: Node version.
@@ -719,7 +708,7 @@ components:
description: A list of authentication providers.
items:
$ref: '#/components/schemas/AuthenticationProviderConfig'
- description: REST representation of AuthenticationConfig.
+ description: Authentication configuration.
AuthenticationProviderConfig:
type: object
description: Configuration for the authentication provider.
@@ -732,15 +721,15 @@ components:
BasicAuthenticationProviderConfig:
type: object
properties:
+ name:
+ type: string
+ description: Provider name.
username:
type: string
description: Username.
password:
type: string
description: Password.
- name:
- type: string
- description: Provider name.
type:
type: string
description: Configuration for basic authentication.
@@ -754,9 +743,16 @@ components:
type: string
description: Unique cluster name.
address:
- $ref: '#/components/schemas/NetworkAddress'
+ description: Network address of this node.
+ allOf:
+ - $ref: '#/components/schemas/NetworkAddress'
+ - type: object
+ description: Cluster network address information.
metadata:
- $ref: '#/components/schemas/NodeMetadata'
+ allOf:
+ - $ref: '#/components/schemas/NodeMetadata'
+ - type: object
+ description: Node metadata information.
description: Information about the cluster node.
ClusterState:
type: object
@@ -777,7 +773,10 @@ components:
type: string
description: Version of Apache Ignite that the cluster was created
on.
clusterTag:
- $ref: '#/components/schemas/ClusterTag'
+ allOf:
+ - $ref: '#/components/schemas/ClusterTag'
+ - type: object
+ description: Unique tag that identifies the cluster.
description: Information about current cluster state.
ClusterTag:
type: object
@@ -807,7 +806,10 @@ components:
type: string
description: The name of the cluster.
authenticationConfig:
- $ref: '#/components/schemas/AuthenticationConfig'
+ allOf:
+ - $ref: '#/components/schemas/AuthenticationConfig'
+ - type: object
+ description: Authentication configuration.
description: Cluster initialization configuration.
InvalidParam:
type: object
@@ -820,18 +822,16 @@ components:
description: The issue with the parameter.
description: Information about invalid request parameter.
Metric:
- required:
- - name
type: object
properties:
name:
type: string
- description: Returns the metric name.
+ description: Metric name.
desc:
type: string
- description: Returns the metric description.
+ description: Metric description.
nullable: true
- description: REST representation of Metric.
+ description: Metric representation.
MetricSet:
required:
- metrics
@@ -839,18 +839,14 @@ components:
type: object
properties:
name:
- required:
- - "true"
type: string
description: Metric set name.
metrics:
- required:
- - "true"
type: array
- description: A list of metrics.
+ description: Metrics.
items:
$ref: '#/components/schemas/Metric'
- description: REST representation of MetricSet.
+ description: Metrics set representation.
MetricSource:
required:
- enabled
@@ -858,13 +854,9 @@ components:
type: object
properties:
name:
- required:
- - "true"
type: string
description: Metric source name.
enabled:
- required:
- - "true"
type: boolean
description: "If True, the metric is tracked. Otherwise, the metric
is not\
\ tracked."
@@ -896,13 +888,19 @@ components:
format: int32
description: Node metadata information.
NodeState:
+ required:
+ - name
+ - state
type: object
properties:
name:
type: string
description: Unique node name.
state:
- $ref: '#/components/schemas/State'
+ allOf:
+ - $ref: '#/components/schemas/State'
+ - type: object
+ description: Node status.
description: Node state.
Problem:
type: object
@@ -946,22 +944,18 @@ components:
- STARTED
- STOPPING
UnitStatus:
- required:
- - id
- - versionToConsistentIds
type: object
properties:
id:
type: string
- description: Returns unit identifier.
+ description: Unit identifier.
versionToConsistentIds:
type: object
additionalProperties:
type: array
items:
type: string
- description: Returns the map of existing unit versions mapped to the
list
- of node consistent ids where these units are deployed.
+ description: Map from unit version to node consistent id where unit
is deployed.
description: Unit status.
Void:
type: object
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/InvalidParam.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/InvalidParam.java
index 1d9442762d..1b6aad0f48 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/InvalidParam.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/InvalidParam.java
@@ -34,7 +34,10 @@ public class InvalidParam {
private final String reason;
@JsonCreator
- public InvalidParam(@JsonProperty("name") String name,
@JsonProperty("reason") String reason) {
+ public InvalidParam(
+ @JsonProperty("name") String name,
+ @JsonProperty("reason") String reason
+ ) {
this.name = name;
this.reason = reason;
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterManagementApi.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterManagementApi.java
index aaf6d10a38..dcef55e5d7 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterManagementApi.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterManagementApi.java
@@ -22,7 +22,6 @@ import io.micronaut.http.annotation.Consumes;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Post;
-import io.micronaut.http.annotation.Produces;
import io.micronaut.security.annotation.Secured;
import io.micronaut.security.rules.SecurityRule;
import io.swagger.v3.oas.annotations.Operation;
@@ -47,16 +46,12 @@ public interface ClusterManagementApi {
@Get("state")
@Operation(operationId = "clusterState", description = "Returns current
cluster status.")
@ApiResponse(responseCode = "200", description = "Cluster status
returned.",
- content = @Content(mediaType = MediaType.APPLICATION_JSON, schema
= @Schema(implementation = ClusterStateDto.class)))
+ content = @Content(mediaType = MediaType.APPLICATION_JSON, schema
= @Schema(implementation = ClusterState.class)))
@ApiResponse(responseCode = "404", description = "Cluster status not
found. Most likely, the cluster is not initialized.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces({
- MediaType.APPLICATION_JSON,
- MediaType.PROBLEM_JSON
- })
- CompletableFuture<ClusterStateDto> clusterState();
+ CompletableFuture<ClusterState> clusterState();
/**
* Initializes cluster.
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterNodeDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterNode.java
similarity index 82%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterNodeDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterNode.java
index af310fe94b..fdf651a726 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterNodeDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterNode.java
@@ -21,14 +21,12 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
-import org.apache.ignite.network.ClusterNode;
/**
- * REST representation of {@link ClusterNode}.
+ * REST representation of {@link org.apache.ignite.network.ClusterNode}.
*/
-@Schema(name = "ClusterNode", description = "Information about the cluster
node.")
-
-public class ClusterNodeDto {
+@Schema(description = "Information about the cluster node.")
+public class ClusterNode {
/** Local id assigned to this node instance. Changes between restarts. */
@Schema(description = "Node ID.")
private final String id;
@@ -39,10 +37,10 @@ public class ClusterNodeDto {
/** Network address of this node. */
@Schema(description = "Cluster network address information.")
- private final NetworkAddressDto address;
+ private final NetworkAddress address;
@Schema(description = "Node metadata information.")
- private final NodeMetadataDto metadata;
+ private final NodeMetadata metadata;
/**
* Constructor.
@@ -52,11 +50,11 @@ public class ClusterNodeDto {
* @param address Node address.
*/
@JsonCreator
- public ClusterNodeDto(
+ public ClusterNode(
@JsonProperty("id") String id,
@JsonProperty("name") String name,
- @JsonProperty("address") NetworkAddressDto address,
- @JsonProperty("metadata") NodeMetadataDto metadata) {
+ @JsonProperty("address") NetworkAddress address,
+ @JsonProperty("metadata") NodeMetadata metadata) {
this.id = id;
this.name = name;
this.address = address;
@@ -84,12 +82,12 @@ public class ClusterNodeDto {
}
@JsonGetter("address")
- public NetworkAddressDto address() {
+ public NetworkAddress address() {
return address;
}
@JsonGetter("metadata")
- public NodeMetadataDto metadata() {
+ public NodeMetadata metadata() {
return metadata;
}
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterStateDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterState.java
similarity index 87%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterStateDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterState.java
index 78fac0ebd5..4fc341f8a7 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterStateDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterState.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.rest.api.cluster;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
@@ -26,8 +27,8 @@ import java.util.Objects;
/**
* REST representation of internal ClusterState.
*/
-@Schema(name = "ClusterState", description = "Information about current
cluster state.")
-public class ClusterStateDto {
+@Schema(description = "Information about current cluster state.")
+public class ClusterState {
@Schema(description = "List of cluster management group nodes. These nodes
are responsible for maintaining RAFT cluster topology.")
private final Collection<String> cmgNodes;
@@ -38,7 +39,7 @@ public class ClusterStateDto {
private final String igniteVersion;
@Schema(description = "Unique tag that identifies the cluster.")
- private final ClusterTagDto clusterTag;
+ private final ClusterTag clusterTag;
/**
* Creates a new cluster state.
@@ -49,11 +50,11 @@ public class ClusterStateDto {
* @param clusterTag Cluster tag.
*/
@JsonCreator
- public ClusterStateDto(
+ public ClusterState(
@JsonProperty("cmgNodes") Collection<String> cmgNodes,
@JsonProperty("msNodes") Collection<String> msNodes,
@JsonProperty("igniteVersion") String igniteVersion,
- @JsonProperty("clusterTag") ClusterTagDto clusterTag
+ @JsonProperty("clusterTag") ClusterTag clusterTag
) {
this.cmgNodes = cmgNodes;
this.msNodes = msNodes;
@@ -61,23 +62,23 @@ public class ClusterStateDto {
this.clusterTag = clusterTag;
}
- @JsonProperty
+ @JsonGetter("cmgNodes")
public Collection<String> cmgNodes() {
return cmgNodes;
}
- @JsonProperty
+ @JsonGetter("msNodes")
public Collection<String> msNodes() {
return msNodes;
}
- @JsonProperty
+ @JsonGetter("igniteVersion")
public String igniteVersion() {
return igniteVersion;
}
- @JsonProperty
- public ClusterTagDto clusterTag() {
+ @JsonGetter("clusterTag")
+ public ClusterTag clusterTag() {
return clusterTag;
}
@@ -89,7 +90,7 @@ public class ClusterStateDto {
if (o == null || getClass() != o.getClass()) {
return false;
}
- ClusterStateDto state = (ClusterStateDto) o;
+ ClusterState state = (ClusterState) o;
return cmgNodes.equals(state.cmgNodes) &&
msNodes.equals(state.msNodes) && igniteVersion.equals(state.igniteVersion)
&& clusterTag.equals(state.clusterTag);
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterTagDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterTag.java
similarity index 85%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterTagDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterTag.java
index 288ddb5cc2..9f6e386a2b 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterTagDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterTag.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.rest.api.cluster;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
@@ -26,8 +27,8 @@ import java.util.UUID;
/**
* REST representation of internal ClusterTag.
*/
-@Schema(name = "ClusterTag", description = "Unique tag that identifies the
cluster.")
-public class ClusterTagDto {
+@Schema(description = "Unique tag that identifies the cluster.")
+public class ClusterTag {
/** Auto-generated part. */
@Schema(description = "Unique cluster UUID. Generated automatically.")
private final UUID clusterId;
@@ -37,17 +38,20 @@ public class ClusterTagDto {
private final String clusterName;
@JsonCreator
- public ClusterTagDto(@JsonProperty("clusterName") String clusterName,
@JsonProperty("clusterId") UUID clusterId) {
+ public ClusterTag(
+ @JsonProperty("clusterName") String clusterName,
+ @JsonProperty("clusterId") UUID clusterId
+ ) {
this.clusterName = clusterName;
this.clusterId = clusterId;
}
- @JsonProperty
+ @JsonGetter("clusterId")
public UUID clusterId() {
return clusterId;
}
- @JsonProperty
+ @JsonGetter("clusterName")
public String clusterName() {
return clusterName;
}
@@ -60,7 +64,7 @@ public class ClusterTagDto {
if (o == null || getClass() != o.getClass()) {
return false;
}
- ClusterTagDto that = (ClusterTagDto) o;
+ ClusterTag that = (ClusterTag) o;
return clusterId.equals(that.clusterId) &&
clusterName.equals(that.clusterName);
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/InitCommand.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/InitCommand.java
index daba36ccb2..528cb02f95 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/InitCommand.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/InitCommand.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.rest.api.cluster;
import static org.apache.ignite.internal.util.CollectionUtils.nullOrEmpty;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
-import
org.apache.ignite.internal.rest.api.cluster.authentication.AuthenticationConfigDto;
+import
org.apache.ignite.internal.rest.api.cluster.authentication.AuthenticationConfig;
import org.apache.ignite.internal.util.StringUtils;
import org.jetbrains.annotations.Nullable;
@@ -44,7 +45,7 @@ public class InitCommand {
private final String clusterName;
@Schema(description = "Authentication configuration.")
- private final AuthenticationConfigDto authenticationConfig;
+ private final AuthenticationConfig authenticationConfig;
/**
* Constructor.
@@ -54,7 +55,7 @@ public class InitCommand {
@JsonProperty("metaStorageNodes") Collection<String>
metaStorageNodes,
@JsonProperty("cmgNodes") @Nullable Collection<String> cmgNodes,
@JsonProperty("clusterName") String clusterName,
- @JsonProperty("authenticationConfig") AuthenticationConfigDto
authenticationConfig
+ @JsonProperty("authenticationConfig") AuthenticationConfig
authenticationConfig
) {
Objects.requireNonNull(metaStorageNodes);
Objects.requireNonNull(clusterName);
@@ -81,23 +82,23 @@ public class InitCommand {
this.authenticationConfig = authenticationConfig;
}
- @JsonProperty
+ @JsonGetter("metaStorageNodes")
public Collection<String> metaStorageNodes() {
return metaStorageNodes;
}
- @JsonProperty
+ @JsonGetter("cmgNodes")
public Collection<String> cmgNodes() {
return cmgNodes;
}
- @JsonProperty
+ @JsonGetter("clusterName")
public String clusterName() {
return clusterName;
}
- @JsonProperty
- public AuthenticationConfigDto authenticationConfig() {
+ @JsonGetter("authenticationConfig")
+ public AuthenticationConfig authenticationConfig() {
return authenticationConfig;
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NetworkAddressDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NetworkAddress.java
similarity index 88%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NetworkAddressDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NetworkAddress.java
index 3f778946f9..6128519738 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NetworkAddressDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NetworkAddress.java
@@ -21,13 +21,12 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
-import org.apache.ignite.network.NetworkAddress;
/**
- * REST representation of {@link NetworkAddress}.
+ * REST representation of {@link org.apache.ignite.network.NetworkAddress}.
*/
-@Schema(name = "NetworkAddress", description = "Node network address
information.")
-public class NetworkAddressDto {
+@Schema(description = "Node network address information.")
+public class NetworkAddress {
/** Host. */
@Schema(description = "Name of the host node runs on.")
private final String host;
@@ -43,7 +42,7 @@ public class NetworkAddressDto {
* @param port Port.
*/
@JsonCreator
- public NetworkAddressDto(
+ public NetworkAddress(
@JsonProperty("host") String host,
@JsonProperty("port") int port
) {
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NodeMetadataDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NodeMetadata.java
similarity index 91%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NodeMetadataDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NodeMetadata.java
index b914009305..b4bb895c74 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NodeMetadataDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/NodeMetadata.java
@@ -21,17 +21,18 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
-import org.apache.ignite.network.NodeMetadata;
/**
- * REST representation of {@link NodeMetadata}.
+ * REST representation of {@link org.apache.ignite.network.NodeMetadata}.
*/
-@Schema(name = "NodeMetadata", description = "Node metadata information.")
-public class NodeMetadataDto {
+@Schema(description = "Node metadata information.")
+public class NodeMetadata {
@Schema(description = "The host exposed to REST API.")
private final String restHost;
+
@Schema(description = "The HTTP port exposed to REST API.")
private final int httpPort;
+
@Schema(description = "The HTTPS port exposed to REST API.")
private final int httpsPort;
@@ -43,7 +44,7 @@ public class NodeMetadataDto {
* @param httpsPort HTTPS port of a node.
*/
@JsonCreator
- public NodeMetadataDto(
+ public NodeMetadata(
@JsonProperty("restHost") String restHost,
@JsonProperty("httpPort") int httpPort,
@JsonProperty("httpsPort") int httpsPort) {
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/TopologyApi.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/TopologyApi.java
index 23a8fbe995..2dcd889d8c 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/TopologyApi.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/TopologyApi.java
@@ -19,10 +19,10 @@ package org.apache.ignite.internal.rest.api.cluster;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
-import io.micronaut.http.annotation.Produces;
import io.micronaut.security.annotation.Secured;
import io.micronaut.security.rules.SecurityRule;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -44,22 +44,24 @@ public interface TopologyApi {
*/
@Get("physical")
@Operation(operationId = "physical", description = "Gets information about
physical cluster topology.")
- @ApiResponse(responseCode = "200", description = "Physical topology
returned.")
+ @ApiResponse(responseCode = "200", description = "Physical topology
returned.",
+ content = @Content(mediaType = MediaType.APPLICATION_JSON,
+ array = @ArraySchema(schema = @Schema(implementation =
ClusterNode.class))))
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces(MediaType.APPLICATION_JSON)
- Collection<ClusterNodeDto> physicalTopology();
+ Collection<ClusterNode> physicalTopology();
/**
* Cluster logical topology.
*/
@Get("logical")
@Operation(operationId = "logical", description = "Gets information about
logical cluster topology.")
- @ApiResponse(responseCode = "200", description = "Logical topology
returned.")
+ @ApiResponse(responseCode = "200", description = "Logical topology
returned.",
+ content = @Content(mediaType = MediaType.APPLICATION_JSON,
+ array = @ArraySchema(schema = @Schema(implementation =
ClusterNode.class))))
@ApiResponse(responseCode = "404", description = "Logical topology not
found. Most likely, the cluster is not initialized.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces(MediaType.APPLICATION_JSON)
- CompletableFuture<Collection<ClusterNodeDto>> logicalTopology();
+ CompletableFuture<Collection<ClusterNode>> logicalTopology();
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationConfigDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationConfig.java
similarity index 85%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationConfigDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationConfig.java
index f776140c35..71e34dd1b9 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationConfigDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationConfig.java
@@ -21,25 +21,24 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
-import org.apache.ignite.security.AuthenticationConfig;
/**
- * REST representation of {@link AuthenticationConfig}.
+ * REST representation of {@link
org.apache.ignite.security.AuthenticationConfig}.
*/
@Schema(name = "AuthenticationConfig")
-public class AuthenticationConfigDto {
+public class AuthenticationConfig {
@Schema(description = "If True, security is enabled. Otherwise it is not.")
private final boolean enabled;
@Schema(description = "A list of authentication providers.")
- private final List<AuthenticationProviderConfigDto> providers;
+ private final List<AuthenticationProviderConfig> providers;
/** Constructor. */
@JsonCreator
- public AuthenticationConfigDto(
+ public AuthenticationConfig(
@JsonProperty("enabled") boolean enabled,
- @JsonProperty("providers") List<AuthenticationProviderConfigDto>
providers
+ @JsonProperty("providers") List<AuthenticationProviderConfig>
providers
) {
if (enabled && (providers == null || providers.isEmpty())) {
@@ -56,7 +55,7 @@ public class AuthenticationConfigDto {
}
@JsonProperty
- public List<AuthenticationProviderConfigDto> providers() {
+ public List<AuthenticationProviderConfig> providers() {
return providers;
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationProviderConfigDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationProviderConfig.java
similarity index 82%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationProviderConfigDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationProviderConfig.java
index e28f7ad5f8..235d405bad 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationProviderConfigDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/AuthenticationProviderConfig.java
@@ -21,33 +21,32 @@ import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.swagger.v3.oas.annotations.media.DiscriminatorMapping;
import io.swagger.v3.oas.annotations.media.Schema;
-import org.apache.ignite.security.AuthenticationProviderConfig;
import org.apache.ignite.security.AuthenticationType;
/**
- * REST representation of {@link AuthenticationProviderConfig}.
+ * REST representation of {@link
org.apache.ignite.security.AuthenticationProviderConfig}.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type")
@JsonSubTypes({
- @JsonSubTypes.Type(value = BasicAuthenticationProviderConfigDto.class,
names = {"basic", "BASIC"})
+ @JsonSubTypes.Type(value = BasicAuthenticationProviderConfig.class,
names = {"basic", "BASIC"})
})
@Schema(
name = "AuthenticationProviderConfig",
description = "Configuration for the authentication provider.",
discriminatorProperty = "type",
discriminatorMapping = {
- @DiscriminatorMapping(value = "basic", schema =
BasicAuthenticationProviderConfigDto.class)
+ @DiscriminatorMapping(value = "basic", schema =
BasicAuthenticationProviderConfig.class)
},
oneOf = {
- BasicAuthenticationProviderConfigDto.class
+ BasicAuthenticationProviderConfig.class
},
subTypes = {
- BasicAuthenticationProviderConfigDto.class
+ BasicAuthenticationProviderConfig.class
}
)
-public interface AuthenticationProviderConfigDto {
+public interface AuthenticationProviderConfig {
/** Authentication type. */
AuthenticationType type();
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/BasicAuthenticationProviderConfigDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/BasicAuthenticationProviderConfig.java
similarity index 92%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/BasicAuthenticationProviderConfigDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/BasicAuthenticationProviderConfig.java
index 6af4d4a0a6..2a42ed3652 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/BasicAuthenticationProviderConfigDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/authentication/BasicAuthenticationProviderConfig.java
@@ -23,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.ignite.internal.util.StringUtils;
import org.apache.ignite.security.AuthenticationType;
-import org.apache.ignite.security.BasicAuthenticationProviderConfig;
/**
* REST representation of {@link BasicAuthenticationProviderConfig}.
*/
@JsonTypeName("basic")
@Schema(name = "BasicAuthenticationProviderConfig", description =
"Configuration for basic authentication.")
-public class BasicAuthenticationProviderConfigDto implements
AuthenticationProviderConfigDto {
+public class BasicAuthenticationProviderConfig implements
AuthenticationProviderConfig {
@Schema(description = "Provider name.")
private final String name;
@@ -43,7 +42,7 @@ public class BasicAuthenticationProviderConfigDto implements
AuthenticationProvi
/** Constructor. */
@JsonCreator
- public BasicAuthenticationProviderConfigDto(
+ public BasicAuthenticationProviderConfig(
@JsonProperty("name") String name,
@JsonProperty("username") String username,
@JsonProperty("password") String password) {
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/ClusterConfigurationApi.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/ClusterConfigurationApi.java
index e2804751d2..f9e0e075d3 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/ClusterConfigurationApi.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/ClusterConfigurationApi.java
@@ -51,19 +51,15 @@ public interface ClusterConfigurationApi {
*/
@Operation(operationId = "getClusterConfiguration", description = "Gets
the current configuration of the cluster.")
@ApiResponse(
- responseCode = "200",
- content = @Content(mediaType = MediaType.TEXT_PLAIN, schema =
@Schema(type = "string")),
- description = "Received cluster configuration.")
+ responseCode = "200", description = "Received cluster
configuration.",
+ content = @Content(mediaType = MediaType.TEXT_PLAIN, schema =
@Schema(type = "string")))
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "400", description = "Incorrect
configuration.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "404", description = "Configuration not found.
Most likely, the cluster is not initialized.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces({
- MediaType.TEXT_PLAIN,
- MediaType.PROBLEM_JSON
- })
+ @Produces(MediaType.PROBLEM_JSON)
@Get
String getConfiguration();
@@ -82,7 +78,6 @@ public interface ClusterConfigurationApi {
@ApiResponse(responseCode = "404", description = "Configuration not found.
Most likely, the cluster is not initialized.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@Consumes(MediaType.TEXT_PLAIN)
- @Produces(MediaType.PROBLEM_JSON)
@Patch
CompletableFuture<Void> updateConfiguration(
@Body @RequestBody(description = "The cluster configuration to
update.") String updatedConfiguration
@@ -96,20 +91,16 @@ public interface ClusterConfigurationApi {
*/
@Operation(operationId = "getClusterConfigurationByPath",
description = "Gets the configuration on the specific path.
Configuration is in HOCON format")
- @ApiResponse(responseCode = "200",
- content = @Content(mediaType = MediaType.TEXT_PLAIN, schema =
@Schema(type = "string")),
- description = "Configuration of the cluster on the specified
path.")
+ @ApiResponse(responseCode = "200", description = "Configuration of the
cluster on the specified path.",
+ content = @Content(mediaType = MediaType.TEXT_PLAIN, schema =
@Schema(type = "string")))
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "400", description = "Incorrect
configuration.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "404", description = "Configuration not found.
Most likely, the cluster is not initialized.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces({
- MediaType.TEXT_PLAIN,
- MediaType.PROBLEM_JSON
- })
+ @Produces(MediaType.PROBLEM_JSON)
@Get("/{path}")
String getConfigurationByPath(@PathVariable("path") @Parameter(required =
true,
- description = "Configuration tree address. For example:
`element.subelement`.") String path);
+ description = "Configuration tree address. For example:
`element.subelement`.") String path);
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/NodeConfigurationApi.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/NodeConfigurationApi.java
index 1610af4634..c7910b674c 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/NodeConfigurationApi.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/configuration/NodeConfigurationApi.java
@@ -44,25 +44,19 @@ import org.apache.ignite.internal.rest.constants.MediaType;
@Secured(SecurityRule.IS_AUTHENTICATED)
@Tag(name = "nodeConfiguration")
public interface NodeConfigurationApi {
-
/**
* Returns node configuration in HOCON format. This is represented as a
plain text.
*
* @return the whole node configuration in HOCON format.
*/
@Operation(operationId = "getNodeConfiguration", description = "Gets node
configuration in HOCON format.")
- @ApiResponse(responseCode = "200",
- content = @Content(mediaType = MediaType.TEXT_PLAIN,
- schema = @Schema(type = "string")),
- description = "Full node configuration.")
+ @ApiResponse(responseCode = "200", description = "Full node
configuration.",
+ content = @Content(mediaType = MediaType.TEXT_PLAIN, schema =
@Schema(type = "string")))
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "400", description = "Incorrect
configuration.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces({
- MediaType.TEXT_PLAIN,
- MediaType.PROBLEM_JSON
- })
+ @Produces(MediaType.PROBLEM_JSON)
@Get
String getConfiguration();
@@ -75,17 +69,13 @@ public interface NodeConfigurationApi {
@Operation(operationId = "getNodeConfigurationByPath",
description = "Gets a configuration of a specific node, in HOCON
format.")
@ApiResponse(responseCode = "200",
- content = @Content(mediaType = MediaType.TEXT_PLAIN,
- schema = @Schema(type = "string")),
+ content = @Content(mediaType = MediaType.TEXT_PLAIN, schema =
@Schema(type = "string")),
description = "Returned node configuration.")
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@ApiResponse(responseCode = "400", description = "Incorrect
configuration.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces({
- MediaType.TEXT_PLAIN,
- MediaType.PROBLEM_JSON
- })
+ @Produces(MediaType.PROBLEM_JSON)
@Get("/{path}")
String getConfigurationByPath(@PathVariable("path") @Parameter(required =
true,
description = "Configuration tree address. For example:
`element.subelement`.") String path);
@@ -103,7 +93,6 @@ public interface NodeConfigurationApi {
@ApiResponse(responseCode = "400", description = "Incorrect
configuration.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@Consumes(MediaType.TEXT_PLAIN)
- @Produces(MediaType.PROBLEM_JSON)
@Patch
CompletableFuture<Void> updateConfiguration(
@Body @RequestBody(description = "The node configuration to
update.") String updatedConfiguration
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
index a3bf64202d..5abfafb69b 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
@@ -18,7 +18,9 @@
package org.apache.ignite.internal.rest.api.deployment;
import static
org.apache.ignite.internal.rest.constants.MediaType.APPLICATION_JSON;
+import static org.apache.ignite.internal.rest.constants.MediaType.FORM_DATA;
import static org.apache.ignite.internal.rest.constants.MediaType.PROBLEM_JSON;
+import static org.apache.ignite.internal.rest.constants.MediaType.TEXT_PLAIN;
import io.micronaut.http.annotation.Consumes;
import io.micronaut.http.annotation.Controller;
@@ -26,18 +28,17 @@ import io.micronaut.http.annotation.Delete;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.PathVariable;
import io.micronaut.http.annotation.Post;
-import io.micronaut.http.annotation.Produces;
import io.micronaut.http.multipart.CompletedFileUpload;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import org.apache.ignite.internal.rest.api.Problem;
-import org.apache.ignite.internal.rest.constants.MediaType;
/**
* REST endpoint allows to deployment code service.
@@ -59,26 +60,23 @@ public interface DeploymentCodeApi {
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
)
- @Consumes(MediaType.FORM_DATA)
- @Produces({
- APPLICATION_JSON,
- PROBLEM_JSON
- })
+ @Consumes(FORM_DATA)
@Post("units")
CompletableFuture<Boolean> deploy(
- @Schema(name = "unitId", description = "The ID of the deployment
unit.", required = true) String unitId,
- @Schema(name = "unitVersion", description = "The version of the
deployment unit.") String unitVersion,
- @Schema(name = "unitContent", description = "The code to
deploy.", required = true) CompletedFileUpload unitContent);
+ @Schema(name = "unitId",
+ requiredMode = RequiredMode.REQUIRED,
+ description = "The ID of the deployment unit.") String
unitId,
+ @Schema(name = "unitVersion",
+ description = "The version of the deployment unit.")
String unitVersion,
+ @Schema(name = "unitContent",
+ requiredMode = RequiredMode.REQUIRED,
+ description = "The code to deploy.") CompletedFileUpload
unitContent);
/**
* Undeploy unit REST method.
*/
@Operation(operationId = "undeployUnit", description = "Undeploys the unit
with provided unitId and unitVersion.")
- @ApiResponse(responseCode = "200",
- description = "Unit undeployed successfully.",
- //DO NOT Remove redundant parameter. It will BREAK generated spec.
- content = @Content(mediaType = APPLICATION_JSON, schema =
@Schema(implementation = Void.class))
- )
+ @ApiResponse(responseCode = "200", description = "Unit undeployed
successfully.")
@ApiResponse(responseCode = "404",
description = "Unit with provided identifier and version does not
exist.",
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
@@ -88,25 +86,18 @@ public interface DeploymentCodeApi {
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
)
@Consumes(APPLICATION_JSON)
- @Produces({
- APPLICATION_JSON,
- PROBLEM_JSON
- })
@Delete("units/{unitId}/{unitVersion}")
CompletableFuture<Void> undeploy(
- @PathVariable("unitId") @Schema(name = "unitId", description =
"The ID of the deployment unit.", required = true) String unitId,
+ @PathVariable("unitId") @Schema(name = "unitId", description =
"The ID of the deployment unit.",
+ requiredMode = RequiredMode.REQUIRED) String unitId,
@PathVariable("unitVersion") @Schema(name = "unitVersion",
- description = "The version of the deployment unit.",
required = true) String unitVersion);
+ description = "The version of the deployment unit.",
requiredMode = RequiredMode.REQUIRED) String unitVersion);
/**
* Undeploy latest unit REST method.
*/
@Operation(operationId = "undeployLatestUnit", description = "Undeploys
the latest unit with the provided unitId.")
- @ApiResponse(responseCode = "200",
- description = "Unit undeployed successfully.",
- //DO NOT Remove redundant parameter. It will BREAK generated spec.
- content = @Content(mediaType = APPLICATION_JSON, schema =
@Schema(implementation = Void.class))
- )
+ @ApiResponse(responseCode = "200", description = "Unit undeployed
successfully.")
@ApiResponse(responseCode = "404",
description = "Unit with provided identifier and version does not
exist.",
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
@@ -116,14 +107,10 @@ public interface DeploymentCodeApi {
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
)
@Consumes(APPLICATION_JSON)
- @Produces({
- APPLICATION_JSON,
- PROBLEM_JSON
- })
@Delete("units/{unitId}")
CompletableFuture<Void> undeploy(
- @PathVariable("unitId") @Schema(name = "unitId",
- description = "The ID of the deployment unit.", required =
true) String unitId);
+ @PathVariable("unitId") @Schema(name = "unitId", description =
"The ID of the deployment unit.",
+ requiredMode = RequiredMode.REQUIRED) String unitId);
/**
* All units status REST method.
@@ -131,19 +118,15 @@ public interface DeploymentCodeApi {
@Operation(operationId = "units", description = "All units statuses.")
@ApiResponse(responseCode = "200",
description = "All statuses returned successfully.",
- content = @Content(mediaType = APPLICATION_JSON, array =
@ArraySchema(schema = @Schema(implementation = UnitStatusDto.class)))
+ content = @Content(mediaType = APPLICATION_JSON, array =
@ArraySchema(schema = @Schema(implementation = UnitStatus.class)))
)
@ApiResponse(responseCode = "500",
description = "Internal error.",
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
)
- @Consumes(MediaType.TEXT_PLAIN)
- @Produces({
- APPLICATION_JSON,
- PROBLEM_JSON
- })
+ @Consumes(TEXT_PLAIN)
@Get("units")
- CompletableFuture<Collection<UnitStatusDto>> units();
+ CompletableFuture<Collection<UnitStatus>> units();
/**
* Versions of unit REST method.
@@ -160,14 +143,10 @@ public interface DeploymentCodeApi {
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@Consumes(APPLICATION_JSON)
- @Produces({
- APPLICATION_JSON,
- PROBLEM_JSON
- })
@Get("units/{unitId}/versions")
CompletableFuture<Collection<String>> versions(
@PathVariable("unitId") @Schema(name = "unitId",
- description = "The ID of the deployment unit.", required =
true) String unitId);
+ description = "The ID of the deployment unit.",
requiredMode = RequiredMode.REQUIRED) String unitId);
/**
* Unit status REST method.
@@ -175,7 +154,7 @@ public interface DeploymentCodeApi {
@Operation(operationId = "status", description = "Returns the status of
the unit with the provided identifier.")
@ApiResponse(responseCode = "200",
description = "Status returned successfully.",
- content = @Content(mediaType = APPLICATION_JSON, schema =
@Schema(implementation = UnitStatusDto.class))
+ content = @Content(mediaType = APPLICATION_JSON, schema =
@Schema(implementation = UnitStatus.class))
)
@ApiResponse(responseCode = "404",
description = "Unit with provided identifier does not exist.",
@@ -186,14 +165,10 @@ public interface DeploymentCodeApi {
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
)
@Consumes(APPLICATION_JSON)
- @Produces({
- APPLICATION_JSON,
- PROBLEM_JSON
- })
@Get("units/{unitId}/status")
- CompletableFuture<UnitStatusDto> status(
+ CompletableFuture<UnitStatus> status(
@PathVariable("unitId") @Schema(name = "unitId",
- description = "The ID of the deployment unit.", required =
true) String unitId);
+ description = "The ID of the deployment unit.",
requiredMode = RequiredMode.REQUIRED) String unitId);
/**
* Find unit by node consistent id.
@@ -201,19 +176,15 @@ public interface DeploymentCodeApi {
@Operation(operationId = "byConsistentId", description = "Returns the
status of units that are deployed on the node.")
@ApiResponse(responseCode = "200",
description = "All statuses returned successfully.",
- content = @Content(mediaType = APPLICATION_JSON, array =
@ArraySchema(schema = @Schema(implementation = UnitStatusDto.class)))
+ content = @Content(mediaType = APPLICATION_JSON, array =
@ArraySchema(schema = @Schema(implementation = UnitStatus.class)))
)
@ApiResponse(responseCode = "500",
description = "Internal error.",
content = @Content(mediaType = PROBLEM_JSON, schema =
@Schema(implementation = Problem.class))
)
@Consumes(APPLICATION_JSON)
- @Produces({
- APPLICATION_JSON,
- PROBLEM_JSON
- })
@Get("units/consistentId/{consistentId}")
- CompletableFuture<Collection<UnitStatusDto>> findByConsistentId(
+ CompletableFuture<Collection<UnitStatus>> findByConsistentId(
@PathVariable("consistentId") @Schema(name = "consistentId",
- description = "The consistent deployment unit
identifier.", required = true) String consistentId);
+ description = "The consistent deployment unit
identifier.", requiredMode = RequiredMode.REQUIRED) String consistentId);
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/UnitStatusDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/UnitStatus.java
similarity index 89%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/UnitStatusDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/UnitStatus.java
index a294add462..afefd59e05 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/UnitStatusDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/UnitStatus.java
@@ -27,21 +27,22 @@ import java.util.Map;
/**
* DTO of unit status.
*/
-@Schema(name = "UnitStatus", description = "Unit status.")
-public class UnitStatusDto {
-
+@Schema(description = "Unit status.")
+public class UnitStatus {
/**
* Unit identifier.
*/
+ @Schema(description = "Unit identifier.")
private final String id;
/**
* Map from existing unit version to list of nodes consistent ids where
unit deployed.
*/
+ @Schema(description = "Map from unit version to node consistent id where
unit is deployed.")
private final Map<String, List<String>> versionToConsistentIds;
@JsonCreator
- public UnitStatusDto(@JsonProperty("id") String id,
+ public UnitStatus(@JsonProperty("id") String id,
@JsonProperty("versionToConsistentIds") Map<String, List<String>>
versionToConsistentIds) {
this.id = id;
this.versionToConsistentIds = versionToConsistentIds;
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/Metric.java
similarity index 90%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/Metric.java
index 7d86cd9673..bcebbe5229 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/Metric.java
@@ -26,12 +26,14 @@ import org.jetbrains.annotations.Nullable;
/**
* REST representation of Metric.
*/
-@Schema(name = "Metric")
-public class MetricDto {
+@Schema(description = "Metric representation.")
+public class Metric {
/** Metric name. */
+ @Schema(description = "Metric name.")
private final String name;
/** Metric description. */
+ @Schema(nullable = true)
private final String desc;
/**
@@ -41,9 +43,9 @@ public class MetricDto {
* @param desc metric description
*/
@JsonCreator
- public MetricDto(
+ public Metric(
@JsonProperty("name") String name,
- @JsonProperty("desc") @Nullable String desc
+ @JsonProperty("desc") String desc
) {
this.name = name;
this.desc = desc;
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSetDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSet.java
similarity index 73%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSetDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSet.java
index 48ed2dce65..3c98e27a85 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSetDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSet.java
@@ -20,21 +20,27 @@ package org.apache.ignite.internal.rest.api.metric;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import java.util.Collection;
/**
* REST representation of MetricSet.
*/
-@Schema(name = "MetricSet")
-public class MetricSetDto {
+@Schema(description = "Metrics set representation.")
+public class MetricSet {
/** Metric set name. */
- @Schema(description = "Metric set name.", required = true)
+ @Schema(description = "Metric set name.", requiredMode =
RequiredMode.REQUIRED)
private final String name;
/** Metrics. */
- @Schema(description = "A list of metrics.", required = true)
- private final Collection<MetricDto> metrics;
+ @ArraySchema(schema = @Schema(
+ description = "A list of metrics.",
+ requiredMode = RequiredMode.REQUIRED,
+ implementation = Metric.class)
+ )
+ private final Collection<Metric> metrics;
/**
* Constructor.
@@ -43,9 +49,9 @@ public class MetricSetDto {
* @param metrics metrics
*/
@JsonCreator
- public MetricSetDto(
+ public MetricSet(
@JsonProperty("name") String name,
- @JsonProperty("metrics") Collection<MetricDto> metrics
+ @JsonProperty("metrics") Collection<Metric> metrics
) {
this.name = name;
this.metrics = metrics;
@@ -67,7 +73,7 @@ public class MetricSetDto {
* @return metrics
*/
@JsonGetter("metrics")
- public Collection<MetricDto> metrics() {
+ public Collection<Metric> metrics() {
return metrics;
}
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSourceDto.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSource.java
similarity index 84%
rename from
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSourceDto.java
rename to
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSource.java
index ea8da2d0d8..66c16ff5f0 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSourceDto.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/MetricSource.java
@@ -21,18 +21,21 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
/**
* REST representation of MetricSource.
*/
-@Schema(name = "MetricSource", description = "A list of metric sources
provided by modules.")
-public class MetricSourceDto {
+@Schema(description = "A list of metric sources provided by modules.")
+public class MetricSource {
/** Name of the metric source. */
- @Schema(description = "Metric source name.", required = true)
+ @Schema(description = "Metric source name.",
+ requiredMode = RequiredMode.REQUIRED)
private final String name;
/** Enabled. */
- @Schema(description = "If True, the metric is tracked. Otherwise, the
metric is not tracked.", required = true)
+ @Schema(description = "If True, the metric is tracked. Otherwise, the
metric is not tracked.",
+ requiredMode = RequiredMode.REQUIRED)
private final boolean enabled;
/**
@@ -42,7 +45,7 @@ public class MetricSourceDto {
* @param enabled flags showing whether this metric source is enabled or
not
*/
@JsonCreator
- public MetricSourceDto(
+ public MetricSource(
@JsonProperty("name") String name,
@JsonProperty("enabled") boolean enabled) {
this.name = name;
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/NodeMetricApi.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/NodeMetricApi.java
index d5bd08376d..d4858f0648 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/NodeMetricApi.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/metric/NodeMetricApi.java
@@ -26,6 +26,7 @@ import io.micronaut.http.annotation.Produces;
import io.micronaut.security.annotation.Secured;
import io.micronaut.security.rules.SecurityRule;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -66,18 +67,21 @@ public interface NodeMetricApi {
/** List metric sources. */
@Operation(operationId = "listNodeMetricSources", description = "Gets a
list of all available metric sources.")
- @ApiResponse(responseCode = "200", description = "Returned a list of
metric sources.")
+ @ApiResponse(responseCode = "200", description = "Returned a list of
metric sources.",
+ content = @Content(mediaType = MediaType.APPLICATION_JSON,
+ array = @ArraySchema(schema = @Schema(implementation =
MetricSource.class))))
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces(MediaType.APPLICATION_JSON)
@Get("source")
- Collection<MetricSourceDto> listMetricSources();
+ Collection<MetricSource> listMetricSources();
/** List metric sets. */
@Operation(operationId = "listNodeMetricSets", description = "Gets a list
of all enabled metric sets.")
- @ApiResponse(responseCode = "200", description = "Returned a list of
metric sets.")
+ @ApiResponse(responseCode = "200", description = "Returned a list of
metric sets.",
+ content = @Content(mediaType = MediaType.APPLICATION_JSON,
+ array = @ArraySchema(schema = @Schema(implementation =
MetricSet.class))))
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
@Get("set")
- Collection<MetricSetDto> listMetricSets();
+ Collection<MetricSet> listMetricSets();
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeManagementApi.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeManagementApi.java
index c16316b233..0fea70e9e6 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeManagementApi.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeManagementApi.java
@@ -47,10 +47,6 @@ public interface NodeManagementApi {
@ApiResponse(responseCode = "500", description = "Internal error.",
content = @Content(mediaType = MediaType.PROBLEM_JSON,
schema = @Schema(implementation = Problem.class)))
})
- @Produces({
- MediaType.APPLICATION_JSON,
- MediaType.PROBLEM_JSON
- })
NodeState state();
@Get("version")
@@ -59,9 +55,6 @@ public interface NodeManagementApi {
content = @Content(mediaType = MediaType.TEXT_PLAIN, schema =
@Schema(type = "string")))
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = MediaType.PROBLEM_JSON, schema =
@Schema(implementation = Problem.class)))
- @Produces({
- MediaType.TEXT_PLAIN,
- MediaType.PROBLEM_JSON
- })
+ @Produces(MediaType.PROBLEM_JSON)
String version();
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeState.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeState.java
index 32a1af47a0..ee5c2dc957 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeState.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/node/NodeState.java
@@ -21,21 +21,22 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
/**
* Node state that is returned by REST.
*/
@Schema(description = "Node state.")
public class NodeState {
+ @Schema(description = "Unique node name.", requiredMode =
RequiredMode.REQUIRED)
+ private final String name;
- @Schema(description = "Unique node name.")
- private String name;
-
- @Schema(description = "Node status.")
- private State state;
+ @Schema(description = "Node status.", requiredMode = RequiredMode.REQUIRED)
+ private final State state;
@JsonCreator
- public NodeState(@JsonProperty("name") String name, @JsonProperty("state")
State state) {
+ public NodeState(@JsonProperty("name") String name,
+ @JsonProperty("state") State state) {
this.name = name;
this.state = state;
}
diff --git
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/constants/MediaType.java
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/constants/MediaType.java
index 213d3ac8b9..2e3edf18b5 100644
---
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/constants/MediaType.java
+++
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/constants/MediaType.java
@@ -38,7 +38,8 @@ public final class MediaType {
*/
public static final String TEXT_PLAIN = "text/plain";
- public static final String OCTET_STREAM = "application/octet-stream";
-
+ /**
+ * multipart/form-data media type.
+ */
public static final String FORM_DATA = "multipart/form-data";
}
diff --git
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/cluster/ItClusterManagementControllerTest.java
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/cluster/ItClusterManagementControllerTest.java
index 0776b6659b..a97d770d11 100644
---
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/cluster/ItClusterManagementControllerTest.java
+++
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/cluster/ItClusterManagementControllerTest.java
@@ -42,7 +42,7 @@ import
org.apache.ignite.internal.configuration.AuthenticationConfiguration;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
import
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
import org.apache.ignite.internal.rest.api.cluster.ClusterManagementApi;
-import org.apache.ignite.internal.rest.api.cluster.ClusterStateDto;
+import org.apache.ignite.internal.rest.api.cluster.ClusterState;
import
org.apache.ignite.internal.rest.authentication.AuthenticationProviderFactory;
import
org.apache.ignite.internal.security.authentication.AuthenticationManagerImpl;
import org.junit.jupiter.api.Test;
@@ -232,7 +232,7 @@ public class ItClusterManagementControllerTest extends
RestTestBase {
void testInitAlreadyInitializedWithAnotherNodes() {
// Given cluster is not initialized
HttpClientResponseException thrownBeforeInit =
assertThrows(HttpClientResponseException.class,
- () -> client.toBlocking().retrieve("state",
ClusterStateDto.class));
+ () -> client.toBlocking().retrieve("state",
ClusterState.class));
// Then status is 404: there is no "state"
assertThat(thrownBeforeInit.getStatus(),
is(equalTo(HttpStatus.NOT_FOUND)));
@@ -262,8 +262,8 @@ public class ItClusterManagementControllerTest extends
RestTestBase {
assertThat(cluster.get(0).startFuture(), willCompleteSuccessfully());
// When get cluster state
- ClusterStateDto state =
- client.toBlocking().retrieve("state", ClusterStateDto.class);
+ ClusterState state =
+ client.toBlocking().retrieve("state", ClusterState.class);
// Then cluster state is valid
assertThat(state.msNodes(),
is(equalTo(List.of(cluster.get(0).clusterService().nodeName()))));
diff --git
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
index 0cafad3431..2a9173f89d 100644
---
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
+++
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
@@ -51,7 +51,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.ignite.internal.deployunit.version.Version;
-import org.apache.ignite.internal.rest.api.deployment.UnitStatusDto;
+import org.apache.ignite.internal.rest.api.deployment.UnitStatus;
import org.apache.ignite.internal.testframework.IntegrationTestBase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -103,7 +103,7 @@ public class DeploymentManagementControllerTest extends
IntegrationTestBase {
assertThat(response.code(), is(OK.code()));
MutableHttpRequest<Object> get = HttpRequest.GET("units");
- UnitStatusDto status = client.toBlocking().retrieve(get,
UnitStatusDto.class);
+ UnitStatus status = client.toBlocking().retrieve(get,
UnitStatus.class);
assertThat(status.id(), is(id));
assertThat(status.versionToConsistentIds().keySet(),
equalTo(Set.of(version)));
@@ -136,7 +136,7 @@ public class DeploymentManagementControllerTest extends
IntegrationTestBase {
assertThat(response.code(), is(OK.code()));
MutableHttpRequest<Object> get = HttpRequest.GET("units");
- UnitStatusDto status = client.toBlocking().retrieve(get,
UnitStatusDto.class);
+ UnitStatus status = client.toBlocking().retrieve(get,
UnitStatus.class);
String version = Version.LATEST.render();
assertThat(status.id(), is(id));
@@ -263,9 +263,9 @@ public class DeploymentManagementControllerTest extends
IntegrationTestBase {
}
- private UnitStatusDto status(String id) {
+ private UnitStatus status(String id) {
MutableHttpRequest<Object> get = HttpRequest.GET("units/" + id +
"/status");
- return client.toBlocking().retrieve(get, UnitStatusDto.class);
+ return client.toBlocking().retrieve(get, UnitStatus.class);
}
}
diff --git
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java
index 12bb20bec0..419e381171 100644
---
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java
+++
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java
@@ -28,24 +28,20 @@ import java.util.concurrent.CompletionException;
import java.util.stream.Collectors;
import org.apache.ignite.internal.cluster.management.ClusterInitializer;
import
org.apache.ignite.internal.cluster.management.ClusterManagementGroupManager;
-import org.apache.ignite.internal.cluster.management.ClusterState;
import org.apache.ignite.internal.logger.IgniteLogger;
import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.rest.api.cluster.ClusterManagementApi;
-import org.apache.ignite.internal.rest.api.cluster.ClusterStateDto;
-import org.apache.ignite.internal.rest.api.cluster.ClusterTagDto;
+import org.apache.ignite.internal.rest.api.cluster.ClusterState;
+import org.apache.ignite.internal.rest.api.cluster.ClusterTag;
import org.apache.ignite.internal.rest.api.cluster.InitCommand;
-import
org.apache.ignite.internal.rest.api.cluster.authentication.AuthenticationConfigDto;
-import
org.apache.ignite.internal.rest.api.cluster.authentication.AuthenticationProviderConfigDto;
-import
org.apache.ignite.internal.rest.api.cluster.authentication.BasicAuthenticationProviderConfigDto;
+import
org.apache.ignite.internal.rest.api.cluster.authentication.AuthenticationConfig;
+import
org.apache.ignite.internal.rest.api.cluster.authentication.AuthenticationProviderConfig;
+import
org.apache.ignite.internal.rest.api.cluster.authentication.BasicAuthenticationProviderConfig;
import
org.apache.ignite.internal.rest.cluster.exception.InvalidArgumentClusterInitializationException;
import
org.apache.ignite.internal.rest.exception.ClusterNotInitializedException;
import org.apache.ignite.lang.IgniteException;
import org.apache.ignite.lang.IgniteInternalException;
-import org.apache.ignite.security.AuthenticationConfig;
-import org.apache.ignite.security.AuthenticationProviderConfig;
import org.apache.ignite.security.AuthenticationType;
-import org.apache.ignite.security.BasicAuthenticationProviderConfig;
/**
* Cluster management controller implementation.
@@ -71,7 +67,7 @@ public class ClusterManagementController implements
ClusterManagementApi {
/** {@inheritDoc} */
@Override
- public CompletableFuture<ClusterStateDto> clusterState() {
+ public CompletableFuture<ClusterState> clusterState() {
return
clusterManagementGroupManager.clusterState().thenApply(this::mapClusterState);
}
@@ -83,8 +79,8 @@ public class ClusterManagementController implements
ClusterManagementApi {
initCommand.cmgNodes());
}
- AuthenticationConfigDto authenticationConfigDto =
initCommand.authenticationConfig();
- AuthenticationConfig authenticationConfig = authenticationConfigDto ==
null
+ AuthenticationConfig authenticationConfigDto =
initCommand.authenticationConfig();
+ org.apache.ignite.security.AuthenticationConfig authenticationConfig =
authenticationConfigDto == null
? disabled()
: authnConfigDtoToRestAuthnConfig(authenticationConfigDto);
@@ -99,16 +95,16 @@ public class ClusterManagementController implements
ClusterManagementApi {
});
}
- private ClusterStateDto mapClusterState(ClusterState clusterState) {
+ private ClusterState
mapClusterState(org.apache.ignite.internal.cluster.management.ClusterState
clusterState) {
if (clusterState == null) {
throw new ClusterNotInitializedException();
}
- return new ClusterStateDto(
+ return new ClusterState(
clusterState.cmgNodes(),
clusterState.metaStorageNodes(),
clusterState.igniteVersion().toString(),
- new ClusterTagDto(clusterState.clusterTag().clusterName(),
clusterState.clusterTag().clusterId())
+ new ClusterTag(clusterState.clusterTag().clusterName(),
clusterState.clusterTag().clusterId())
);
}
@@ -127,11 +123,11 @@ public class ClusterManagementController implements
ClusterManagementApi {
return new IgniteException(ex);
}
- private AuthenticationConfig
authnConfigDtoToRestAuthnConfig(AuthenticationConfigDto configDto) {
- return new AuthenticationConfig(configDto.enabled(),
authnProviders(configDto.providers()));
+ private org.apache.ignite.security.AuthenticationConfig
authnConfigDtoToRestAuthnConfig(AuthenticationConfig configDto) {
+ return new
org.apache.ignite.security.AuthenticationConfig(configDto.enabled(),
authnProviders(configDto.providers()));
}
- private List<AuthenticationProviderConfig>
authnProviders(List<AuthenticationProviderConfigDto> providers) {
+ private List<org.apache.ignite.security.AuthenticationProviderConfig>
authnProviders(List<AuthenticationProviderConfig> providers) {
if (providers == null) {
return Collections.emptyList();
} else {
@@ -141,11 +137,12 @@ public class ClusterManagementController implements
ClusterManagementApi {
}
}
- private AuthenticationProviderConfig
authnProviderConfigDtoToAuthnProviderConfig(AuthenticationProviderConfigDto
configDto) {
+ private org.apache.ignite.security.AuthenticationProviderConfig
authnProviderConfigDtoToAuthnProviderConfig(
+ AuthenticationProviderConfig configDto) {
AuthenticationType type = configDto.type();
if (type == AuthenticationType.BASIC) {
- BasicAuthenticationProviderConfigDto
basicAuthenticationProviderConfigDto = (BasicAuthenticationProviderConfigDto)
configDto;
- return new BasicAuthenticationProviderConfig(
+ BasicAuthenticationProviderConfig
basicAuthenticationProviderConfigDto = (BasicAuthenticationProviderConfig)
configDto;
+ return new
org.apache.ignite.security.BasicAuthenticationProviderConfig(
basicAuthenticationProviderConfigDto.name(),
basicAuthenticationProviderConfigDto.username(),
basicAuthenticationProviderConfigDto.password()
diff --git
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/TopologyController.java
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/TopologyController.java
index 61cb890a91..b776550afb 100644
---
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/TopologyController.java
+++
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/TopologyController.java
@@ -26,14 +26,11 @@ import java.util.concurrent.CompletableFuture;
import
org.apache.ignite.internal.cluster.management.ClusterManagementGroupManager;
import org.apache.ignite.internal.cluster.management.topology.api.LogicalNode;
import
org.apache.ignite.internal.cluster.management.topology.api.LogicalTopologySnapshot;
-import org.apache.ignite.internal.rest.api.cluster.ClusterNodeDto;
-import org.apache.ignite.internal.rest.api.cluster.NetworkAddressDto;
-import org.apache.ignite.internal.rest.api.cluster.NodeMetadataDto;
+import org.apache.ignite.internal.rest.api.cluster.ClusterNode;
+import org.apache.ignite.internal.rest.api.cluster.NetworkAddress;
+import org.apache.ignite.internal.rest.api.cluster.NodeMetadata;
import org.apache.ignite.internal.rest.api.cluster.TopologyApi;
import
org.apache.ignite.internal.rest.exception.ClusterNotInitializedException;
-import org.apache.ignite.network.ClusterNode;
-import org.apache.ignite.network.NetworkAddress;
-import org.apache.ignite.network.NodeMetadata;
import org.apache.ignite.network.TopologyService;
/**
@@ -52,13 +49,13 @@ public class TopologyController implements TopologyApi {
/** {@inheritDoc} */
@Override
- public Collection<ClusterNodeDto> physicalTopology() {
+ public Collection<ClusterNode> physicalTopology() {
return toClusterNodeDtos(topologyService.allMembers());
}
/** {@inheritDoc} */
@Override
- public CompletableFuture<Collection<ClusterNodeDto>> logicalTopology() {
+ public CompletableFuture<Collection<ClusterNode>> logicalTopology() {
// TODO: IGNITE-18277 - return an object containing both nodes and
topology version.
return cmgManager.clusterState()
@@ -73,25 +70,25 @@ public class TopologyController implements TopologyApi {
.thenApply(TopologyController::toClusterNodeDtosFromLogicalNodes);
}
- private static List<ClusterNodeDto>
toClusterNodeDtos(Collection<ClusterNode> nodes) {
+ private static List<ClusterNode>
toClusterNodeDtos(Collection<org.apache.ignite.network.ClusterNode> nodes) {
return
nodes.stream().map(TopologyController::toClusterNodeDto).collect(toList());
}
- private static List<ClusterNodeDto>
toClusterNodeDtosFromLogicalNodes(Collection<LogicalNode> nodes) {
+ private static List<ClusterNode>
toClusterNodeDtosFromLogicalNodes(Collection<LogicalNode> nodes) {
return
nodes.stream().map(TopologyController::toClusterNodeDto).collect(toList());
}
- private static ClusterNodeDto toClusterNodeDto(ClusterNode node) {
- NetworkAddress addr = node.address();
+ private static ClusterNode
toClusterNodeDto(org.apache.ignite.network.ClusterNode node) {
+ org.apache.ignite.network.NetworkAddress addr = node.address();
- var addrDto = new NetworkAddressDto(addr.host(), addr.port());
- return new ClusterNodeDto(node.id(), node.name(), addrDto,
toNodeMetadataDto(node.nodeMetadata()));
+ var addrDto = new NetworkAddress(addr.host(), addr.port());
+ return new ClusterNode(node.id(), node.name(), addrDto,
toNodeMetadataDto(node.nodeMetadata()));
}
- private static NodeMetadataDto toNodeMetadataDto(NodeMetadata metadata) {
+ private static NodeMetadata
toNodeMetadataDto(org.apache.ignite.network.NodeMetadata metadata) {
if (metadata == null) {
return null;
}
- return new NodeMetadataDto(metadata.restHost(), metadata.httpPort(),
metadata.httpsPort());
+ return new NodeMetadata(metadata.restHost(), metadata.httpPort(),
metadata.httpsPort());
}
}
diff --git
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
index 73a56d6b35..ca59666187 100644
---
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
+++
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
@@ -30,10 +30,9 @@ import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import org.apache.ignite.internal.deployunit.DeploymentUnit;
import org.apache.ignite.internal.deployunit.IgniteDeployment;
-import org.apache.ignite.internal.deployunit.UnitStatus;
import org.apache.ignite.internal.deployunit.version.Version;
import org.apache.ignite.internal.rest.api.deployment.DeploymentCodeApi;
-import org.apache.ignite.internal.rest.api.deployment.UnitStatusDto;
+import org.apache.ignite.internal.rest.api.deployment.UnitStatus;
/**
* Implementation of {@link DeploymentCodeApi}.
@@ -70,7 +69,7 @@ public class DeploymentManagementController implements
DeploymentCodeApi {
}
@Override
- public CompletableFuture<Collection<UnitStatusDto>> units() {
+ public CompletableFuture<Collection<UnitStatus>> units() {
return deployment.unitsAsync().thenApply(statuses ->
statuses.stream().map(DeploymentManagementController::fromUnitStatus)
.collect(Collectors.toList()));
}
@@ -82,12 +81,12 @@ public class DeploymentManagementController implements
DeploymentCodeApi {
}
@Override
- public CompletableFuture<UnitStatusDto> status(String unitId) {
+ public CompletableFuture<UnitStatus> status(String unitId) {
return
deployment.statusAsync(unitId).thenApply(DeploymentManagementController::fromUnitStatus);
}
@Override
- public CompletableFuture<Collection<UnitStatusDto>>
findByConsistentId(String consistentId) {
+ public CompletableFuture<Collection<UnitStatus>> findByConsistentId(String
consistentId) {
return deployment.findUnitByConsistentIdAsync(consistentId)
.thenApply(units ->
units.stream().map(DeploymentManagementController::fromUnitStatus)
.collect(Collectors.toList()));
@@ -115,12 +114,12 @@ public class DeploymentManagementController implements
DeploymentCodeApi {
* @param status Unit status.
* @return Unit status DTO.
*/
- public static UnitStatusDto fromUnitStatus(UnitStatus status) {
+ public static UnitStatus
fromUnitStatus(org.apache.ignite.internal.deployunit.UnitStatus status) {
Map<String, List<String>> versionToConsistentIds = new HashMap<>();
Set<Version> versions = status.versions();
for (Version version : versions) {
versionToConsistentIds.put(version.render(),
status.consistentIds(version));
}
- return new UnitStatusDto(status.id(), versionToConsistentIds);
+ return new UnitStatus(status.id(), versionToConsistentIds);
}
}
diff --git
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/metrics/NodeMetricController.java
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/metrics/NodeMetricController.java
index c366e763fd..914d670d78 100644
---
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/metrics/NodeMetricController.java
+++
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/metrics/NodeMetricController.java
@@ -23,9 +23,9 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.apache.ignite.internal.metrics.MetricManager;
-import org.apache.ignite.internal.rest.api.metric.MetricDto;
-import org.apache.ignite.internal.rest.api.metric.MetricSetDto;
-import org.apache.ignite.internal.rest.api.metric.MetricSourceDto;
+import org.apache.ignite.internal.rest.api.metric.Metric;
+import org.apache.ignite.internal.rest.api.metric.MetricSet;
+import org.apache.ignite.internal.rest.api.metric.MetricSource;
import org.apache.ignite.internal.rest.api.metric.NodeMetricApi;
import
org.apache.ignite.internal.rest.metrics.exception.MetricNotFoundException;
@@ -57,20 +57,20 @@ public class NodeMetricController implements NodeMetricApi {
}
@Override
- public Collection<MetricSourceDto> listMetricSources() {
+ public Collection<MetricSource> listMetricSources() {
return metricManager.metricSources().stream()
- .map(source -> new MetricSourceDto(source.name(),
source.enabled()))
+ .map(source -> new MetricSource(source.name(),
source.enabled()))
.collect(Collectors.toList());
}
@Override
- public Collection<MetricSetDto> listMetricSets() {
+ public Collection<MetricSet> listMetricSets() {
return metricManager.metricSnapshot().get1().values().stream()
.map(metricSet -> {
- List<MetricDto> metricDtos =
StreamSupport.stream(metricSet.spliterator(), false)
- .map(metric -> new MetricDto(metric.name(),
metric.description()))
+ List<Metric> metricDtos =
StreamSupport.stream(metricSet.spliterator(), false)
+ .map(metric -> new Metric(metric.name(),
metric.description()))
.collect(Collectors.toList());
- return new MetricSetDto(metricSet.name(), metricDtos);
+ return new MetricSet(metricSet.name(), metricDtos);
})
.collect(Collectors.toList());
}