Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package org.cloudfoundry.multiapps.controller.api.v1;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
Comment on lines +4 to +9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this file be part of the PR because I don't see changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was refactor after I formatted the code.

import jakarta.inject.Inject;

import org.cloudfoundry.multiapps.controller.api.Constants.Endpoints;
import org.cloudfoundry.multiapps.controller.api.Constants.PathVariables;
import org.cloudfoundry.multiapps.controller.api.Constants.RequestVariables;
Expand All @@ -23,13 +27,6 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;

@Api
@RestController
@RequestMapping(Resources.FILES)
Expand All @@ -45,8 +42,8 @@ public class FilesApi {
}) }, tags = {})
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = FileMetadata.class, responseContainer = "List") })
public ResponseEntity<List<FileMetadata>>
getFiles(@ApiParam(value = "GUID of space with mtas") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "Filter mtas by namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace) {
getFiles(@ApiParam(value = "GUID of space with mtas") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "Filter mtas by namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace) {
return delegate.getFiles(spaceGuid, namespace);
}

Expand All @@ -57,9 +54,9 @@ public class FilesApi {
}) }, tags = {})
@ApiResponses(value = { @ApiResponse(code = 201, message = "Created", response = FileMetadata.class) })
public ResponseEntity<FileMetadata>
uploadFile(MultipartHttpServletRequest request,
@ApiParam(value = "GUID of space you wish to deploy in") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "file namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace) {
uploadFile(MultipartHttpServletRequest request,
@ApiParam(value = "GUID of space you wish to deploy in") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "file namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace) {
return delegate.uploadFile(request, spaceGuid, namespace);
}

Expand All @@ -70,9 +67,9 @@ public class FilesApi {
}) }, tags = {})
@ApiResponses(value = { @ApiResponse(code = 202, message = "Accepted") })
public ResponseEntity<Void>
startUploadFromUrl(@ApiParam(value = "GUID of space you wish to deploy in") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "file namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace,
@ApiParam(value = "URL reference to a remote file") @RequestBody FileUrl fileUrl) {
startUploadFromUrl(@ApiParam(value = "GUID of space you wish to deploy in") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "file namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace,
@ApiParam(value = "URL reference to a remote file") @RequestBody FileUrl fileUrl) {
return delegate.startUploadFromUrl(spaceGuid, namespace, fileUrl);
}

Expand All @@ -84,9 +81,9 @@ public class FilesApi {
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 201, message = "Created", response = AsyncUploadResult.class) })
public ResponseEntity<AsyncUploadResult>
getUploadFromUrlJob(@ApiParam(value = "GUID of space you wish to deploy in") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "file namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace,
@ApiParam(value = "ID of the upload job") @PathVariable(PathVariables.JOB_ID) String jobId) {
getUploadFromUrlJob(@ApiParam(value = "GUID of space you wish to deploy in") @PathVariable(PathVariables.SPACE_GUID) String spaceGuid,
@ApiParam(value = "file namespace") @RequestParam(name = RequestVariables.NAMESPACE, required = false) String namespace,
@ApiParam(value = "ID of the upload job") @PathVariable(PathVariables.JOB_ID) String jobId) {
return delegate.getUploadFromUrlJob(spaceGuid, namespace, jobId);
}

Expand Down
8 changes: 4 additions & 4 deletions multiapps-controller-persistence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>aws-s3</artifactId>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>azureblob</artifactId>
<groupId>software.amazon.awssdk</groupId>
<artifactId>url-connection-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@
requires spring.beans;
requires spring.context;
requires spring.core;

requires software.amazon.awssdk.services.s3;
requires software.amazon.awssdk.core;
requires software.amazon.awssdk.regions;
requires software.amazon.awssdk.auth;
requires software.amazon.awssdk.http;
requires software.amazon.awssdk.http.urlconnection;
requires software.amazon.awssdk.retries;
requires software.amazon.awssdk.retries.api;
Comment on lines +63 to +70
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, i think some of these are not required. can you check?

requires static java.compiler;
requires static org.immutables.value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public final class Messages {
public static final String APPLICATION_SHUTDOWN_WITH_APPLICATION_INSTANCE_ID_ALREADY_EXIST = "Application shutdown application instance ID \"{0}\" already exist";
public static final String SECRET_TOKEN_WITH_ID_NOT_EXIST = "Secret token with ID \"{0}\" does not exist";
public static final String DATABASE_HEALTH_CHECK_FAILED = "Database health check failed";
public static final String OBJECT_STORE_BUCKET_NOT_FOUND = "Object store bucket \"{0}\" not found";
public static final String UPLOAD_OF_FILE_WITH_NAMESPACE_FAILED = "Upload of file: \"{0}\" with namespace: \"{1}\" failed";

// ERROR log messages:
public static final String UPLOAD_STREAM_FAILED_TO_CLOSE = "Cannot close file upload stream";
Expand Down Expand Up @@ -77,6 +79,8 @@ public final class Messages {
public static final String RETRIEVED_SECRET_TOKEN_WITH_ID_0_FOR_PROCESS_WITH_ID_1 = "Retrieved secret token with id \"{0}\" for process with id \"{1}\"";
public static final String DELETED_0_SECRET_TOKENS_FOR_PROCESS_WITH_ID_1 = "Deleted \"{0}\" secret tokens for process with id \"{1}\"";
public static final String DELETED_0_SECRET_TOKENS_WITH_EXPIRATION_DATE_1 = "Deleted secret tokens \"{0}\" with an expiration date \"{1}\"";
public static final String FAILED_TO_DELETE_FILE_0_IN_OBJECT_STORE_REASON_1 = "Failed to delete file \"{0}\" in object store. Reason: {1}";
public static final String S3_UPLOAD_FAILED_FILE_0_SIZE_1 = "S3 upload failed for file \"{0}\" (size={1}). Root cause chain: {2}";

protected Messages() {
}
Expand Down
Loading
Loading