Class AwsS3Controller


  • @Validated
    @RestController
    @RequestMapping("/api/2/aws/s3")
    public class AwsS3Controller
    extends Object
    Rest controller for AWS S3 service.
    Author:
    joseross
    • Constructor Detail

      • AwsS3Controller

        public AwsS3Controller()
    • 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 id
        profileId - the profile id
        path - the path to list
        type - the type of file to list
        Returns:
        the list of items
        Throws:
        AwsException - if there is any error connecting to S3
        SiteNotFoundException - if the site is not found
        org.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 file
        InvalidParametersException - if there is any error parsing the request
        AwsException - if there is any error connecting to S3
        SiteNotFoundException - if the site is not found
        org.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException - if the profile is not found
        org.craftercms.commons.validation.ValidationException