PakhomovAlexander commented on code in PR #1733: URL: https://github.com/apache/ignite-3/pull/1733#discussion_r1125462460
########## modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java: ########## @@ -0,0 +1,190 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +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.PROBLEM_JSON; + +import io.micronaut.http.annotation.Consumes; +import io.micronaut.http.annotation.Controller; +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.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. + */ +@Controller("/management/v1/deployment/") +@Tag(name = "deployment") +public interface DeploymentCodeApi { Review Comment: Don't you think this class should be located in `rest-api` module? ########## modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/IgniteRunnerTest.java: ########## @@ -67,4 +73,26 @@ public void smokeTestArgs() throws Exception { assertThat(ign, willCompleteSuccessfully()); } + + private static final String NODE_BOOTSTRAP_CFG = "{\n" + + " network: {\n" + + " port:{},\n" + + " portRange: 5,\n" + + " nodeFinder:{\n" + + " netClusterNodes: [ {} ]\n" + + " }\n" + + " }\n" + + "}"; + + + public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { Review Comment: I think it's better to remove it. ########## modules/rest/openapi/openapi.yaml: ########## @@ -319,6 +319,209 @@ paths: application/problem+json: schema: $ref: '#/components/schemas/Problem' + /management/v1/deployment/units: + get: + tags: + - deployment + description: All units statutes. + operationId: units + parameters: [] + responses: + "200": + description: All statutes returned successful. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/UnitStatus' + "500": + description: Internal error. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + post: + tags: + - deployment + description: Deploy provided unit to node. + operationId: deployUnit + parameters: [] + requestBody: + content: + multipart/form-data: + schema: + required: + - unitContent + - unitId + type: object + properties: + unitId: + required: + - "true" + type: string + unitVersion: + type: string + unitContent: + required: + - "true" + type: string + format: binary + required: true + responses: + "200": + description: Unit deployed successfully. + content: + application/json: + schema: + type: boolean + "500": Review Comment: What if there is already a unit with the same is and version? I think we return 409 but its not mentioned in the spec. ########## modules/rest/openapi/openapi.yaml: ########## @@ -319,6 +319,209 @@ paths: application/problem+json: schema: $ref: '#/components/schemas/Problem' + /management/v1/deployment/units: + get: + tags: + - deployment + description: All units statutes. + operationId: units + parameters: [] + responses: + "200": + description: All statutes returned successful. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/UnitStatus' + "500": + description: Internal error. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + post: + tags: + - deployment + description: Deploy provided unit to node. Review Comment: ```suggestion description: Deploy provided unit to the cluster. ``` ########## modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentCodeRestFactory.java: ########## @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.rest.deployment; + +import io.micronaut.context.annotation.Bean; +import io.micronaut.context.annotation.Factory; +import jakarta.inject.Singleton; +import org.apache.ignite.deployment.IgniteDeployment; +import org.apache.ignite.internal.rest.RestFactory; + +/** + * Factory of {@link DeploymentManagementController}. + */ +@Factory +public class DeploymentCodeRestFactory implements RestFactory { Review Comment: ```suggestion public class CodeDeploymentRestFactory implements RestFactory { ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
