Class AwsS3Controller
java.lang.Object
org.craftercms.studio.controller.rest.v2.aws.AwsS3Controller
@Validated
@RestController
@RequestMapping("/api/2/aws/s3")
public class AwsS3Controller
extends Object
Rest controller for AWS S3 service.
- Author:
- joseross
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList items in an S3 bucket.uploadItem
(jakarta.servlet.http.HttpServletRequest request) Upload a file to an S3 bucket.
-
Field Details
-
s3Service
-
-
Constructor Details
-
AwsS3Controller
public AwsS3Controller()
-
-
Method Details
-
listItems
@GetMapping("/list") public ResultList<S3Item> listItems(@RequestParam("siteId") String siteId, @RequestParam("profileId") String profileId, @RequestParam(value="path",required=false,defaultValue="") String path, @RequestParam(value="type",required=false,defaultValue="") String type) throws AwsException, SiteNotFoundException, org.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException List items in an S3 bucket.- Parameters:
siteId
- the site idprofileId
- the profile idpath
- the path to listtype
- the type of file to list- Returns:
- the list of items
- Throws:
AwsException
- if there is any error connecting to S3SiteNotFoundException
- if the site is not foundorg.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
- if the profile is not found
-
uploadItem
@PostMapping("/upload") public ResultOne<S3Item> uploadItem(jakarta.servlet.http.HttpServletRequest request) throws IOException, InvalidParametersException, AwsException, SiteNotFoundException, org.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException, org.craftercms.commons.validation.ValidationException Upload a file to an S3 bucket.- Parameters:
request
- the request- Returns:
- the item uploaded
- Throws:
IOException
- if there is any error reading the content of the fileInvalidParametersException
- if there is any error parsing the requestAwsException
- if there is any error connecting to S3SiteNotFoundException
- if the site is not foundorg.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
- if the profile is not foundorg.craftercms.commons.validation.ValidationException
-