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 Modifier and Type Field Description protected AwsS3Service
s3Service
-
Constructor Summary
Constructors Constructor Description AwsS3Controller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResultList<S3Item>
listItems(String siteId, String profileId, String path, String type)
List items in an S3 bucket.ResultOne<S3Item>
uploadItem(javax.servlet.http.HttpServletRequest request)
Upload a file to an S3 bucket.
-
-
-
Field Detail
-
s3Service
@Autowired protected AwsS3Service s3Service
-
-
Method Detail
-
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(javax.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
-
-