Package com.adobe.testing.s3mock
Class BucketController
java.lang.Object
com.adobe.testing.s3mock.BucketController
@CrossOrigin(origins="*",
exposedHeaders="*")
@Controller
@RequestMapping("${com.adobe.testing.s3mock.contextPath:}")
public class BucketController
extends Object
Handles requests related to buckets.
-
Constructor Summary
ConstructorsConstructorDescriptionBucketController(BucketService bucketService, software.amazon.awssdk.regions.Region region) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Void> createBucket(String bucketName, boolean objectLockEnabled) Create a bucket if the name matches a simplified version of the bucket naming rules.org.springframework.http.ResponseEntity<Void> deleteBucket(String bucketName) Delete a bucket.org.springframework.http.ResponseEntity<Void> deleteBucketLifecycleConfiguration(String bucketName) Delete BucketLifecycleConfiguration of a bucket.org.springframework.http.ResponseEntity<BucketLifecycleConfiguration> getBucketLifecycleConfiguration(String bucketName) Get BucketLifecycleConfiguration of a bucket.org.springframework.http.ResponseEntity<LocationConstraint> getBucketLocation(String bucketName) Get location of a bucket.org.springframework.http.ResponseEntity<ObjectLockConfiguration> getObjectLockConfiguration(String bucketName) Get ObjectLockConfiguration of a bucket.org.springframework.http.ResponseEntity<Void> headBucket(String bucketName) Check if a bucket exists.org.springframework.http.ResponseEntity<ListAllMyBucketsResult> List all existing buckets.org.springframework.http.ResponseEntity<ListBucketResult> listObjects(String bucketName, String prefix, String delimiter, String marker, String encodingType, Integer maxKeys) Deprecated, for removal: This API element is subject to removal in a future version.Long since replaced by ListObjectsV2,org.springframework.http.ResponseEntity<ListBucketResultV2> listObjectsV2(String bucketName, String prefix, String delimiter, String encodingType, String startAfter, Integer maxKeys, String continuationToken) Retrieve list of objects of a bucket.org.springframework.http.ResponseEntity<ListVersionsResult> listObjectVersions(String bucketName, String prefix, String delimiter, String keyMarker, String versionIdMarker, String encodingType, String startAfter, Integer maxKeys, String continuationToken) Retrieve list of versions of an object of a bucket.org.springframework.http.ResponseEntity<Void> putBucketLifecycleConfiguration(String bucketName, BucketLifecycleConfiguration configuration) Put BucketLifecycleConfiguration of a bucket.org.springframework.http.ResponseEntity<Void> putObjectLockConfiguration(String bucketName, ObjectLockConfiguration configuration) Put ObjectLockConfiguration of a bucket.
-
Constructor Details
-
BucketController
-
-
Method Details
-
listBuckets
@GetMapping(value="/", produces="application/xml") public org.springframework.http.ResponseEntity<ListAllMyBucketsResult> listBuckets()List all existing buckets. API Reference- Returns:
- List of all Buckets
-
createBucket
@PutMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params={"!object-lock","!lifecycle"}) public org.springframework.http.ResponseEntity<Void> createBucket(@PathVariable String bucketName, @RequestHeader(value="x-amz-bucket-object-lock-enabled",required=false,defaultValue="false") boolean objectLockEnabled) Create a bucket if the name matches a simplified version of the bucket naming rules. API Reference Bucket Naming API Reference- Parameters:
bucketName- name of the bucket that should be created.- Returns:
- 200 OK if creation was successful.
-
headBucket
@RequestMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, method=HEAD) public org.springframework.http.ResponseEntity<Void> headBucket(@PathVariable String bucketName) Check if a bucket exists. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 200 if it exists; 404 if not found.
-
deleteBucket
@DeleteMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params="!lifecycle") public org.springframework.http.ResponseEntity<Void> deleteBucket(@PathVariable String bucketName) Delete a bucket. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 204 if Bucket was deleted; 404 if not found
-
getObjectLockConfiguration
@GetMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params={"object-lock","!list-type"}, produces="application/xml") public org.springframework.http.ResponseEntity<ObjectLockConfiguration> getObjectLockConfiguration(@PathVariable String bucketName) Get ObjectLockConfiguration of a bucket. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 200, ObjectLockConfiguration
-
putObjectLockConfiguration
@PutMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params="object-lock", consumes="application/xml") public org.springframework.http.ResponseEntity<Void> putObjectLockConfiguration(@PathVariable String bucketName, @RequestBody ObjectLockConfiguration configuration) Put ObjectLockConfiguration of a bucket. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 200, ObjectLockConfiguration
-
getBucketLifecycleConfiguration
@GetMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params={"lifecycle","!list-type"}, produces="application/xml") public org.springframework.http.ResponseEntity<BucketLifecycleConfiguration> getBucketLifecycleConfiguration(@PathVariable String bucketName) Get BucketLifecycleConfiguration of a bucket. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 200, ObjectLockConfiguration
-
putBucketLifecycleConfiguration
@PutMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params="lifecycle", consumes="application/xml") public org.springframework.http.ResponseEntity<Void> putBucketLifecycleConfiguration(@PathVariable String bucketName, @RequestBody BucketLifecycleConfiguration configuration) Put BucketLifecycleConfiguration of a bucket. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 200, ObjectLockConfiguration
-
deleteBucketLifecycleConfiguration
@DeleteMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params="lifecycle") public org.springframework.http.ResponseEntity<Void> deleteBucketLifecycleConfiguration(@PathVariable String bucketName) Delete BucketLifecycleConfiguration of a bucket. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 200, ObjectLockConfiguration
-
getBucketLocation
@GetMapping(value="/{bucketName:.+}", params="location") public org.springframework.http.ResponseEntity<LocationConstraint> getBucketLocation(@PathVariable String bucketName) Get location of a bucket. API Reference- Parameters:
bucketName- name of the Bucket.- Returns:
- 200, LocationConstraint
-
listObjects
@GetMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params={"!uploads","!object-lock","!list-type","!lifecycle","!location","!versions"}, produces="application/xml") @Deprecated(since="2.12.2", forRemoval=true) public org.springframework.http.ResponseEntity<ListBucketResult> listObjects(@PathVariable String bucketName, @RequestParam(required=false) String prefix, @RequestParam(required=false) String delimiter, @RequestParam(required=false) String marker, @RequestParam(name="encoding-type",required=false) String encodingType, @RequestParam(name="max-keys",defaultValue="1000",required=false) Integer maxKeys) Deprecated, for removal: This API element is subject to removal in a future version.Long since replaced by ListObjectsV2,Retrieve list of objects of a bucket. API Reference- Parameters:
bucketName-Stringset bucket nameprefix-Stringfind object names they start with prefixencodingType- whether to use URL encoding (encodingtype="url") or not- Returns:
ListBucketResulta list of objects in Bucket
-
listObjectsV2
@GetMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params="list-type=2", produces="application/xml") public org.springframework.http.ResponseEntity<ListBucketResultV2> listObjectsV2(@PathVariable String bucketName, @RequestParam(required=false) String prefix, @RequestParam(required=false) String delimiter, @RequestParam(name="encoding-type",required=false) String encodingType, @RequestParam(name="start-after",required=false) String startAfter, @RequestParam(name="max-keys",defaultValue="1000",required=false) Integer maxKeys, @RequestParam(name="continuation-token",required=false) String continuationToken) Retrieve list of objects of a bucket. API Reference- Parameters:
bucketName-Stringset bucket nameprefix-Stringfind object names they start with prefixstartAfter-Stringreturn key names after a specific object key in your key spacemaxKeys-Integerset maximum number of keys to be returnedcontinuationToken-Stringpagination token returned by previous request- Returns:
ListBucketResultV2a list of objects in Bucket
-
listObjectVersions
@GetMapping(value={"/{bucketName:.+}","/{bucketName:.+}/"}, params="versions", produces="application/xml") public org.springframework.http.ResponseEntity<ListVersionsResult> listObjectVersions(@PathVariable String bucketName, @RequestParam(required=false) String prefix, @RequestParam(required=false) String delimiter, @RequestParam(name="key-marker",required=false) String keyMarker, @RequestParam(name="version-id-marker",required=false) String versionIdMarker, @RequestParam(name="encoding-type",required=false) String encodingType, @RequestParam(name="start-after",required=false) String startAfter, @RequestParam(name="max-keys",defaultValue="1000",required=false) Integer maxKeys, @RequestParam(name="continuation-token",required=false) String continuationToken) Retrieve list of versions of an object of a bucket. API Reference- Parameters:
bucketName-Stringset bucket nameprefix-Stringfind object names they start with prefixstartAfter-Stringreturn key names after a specific object key in your key spacemaxKeys-Integerset maximum number of keys to be returnedcontinuationToken-Stringpagination token returned by previous request- Returns:
ListVersionsResulta list of objects in Bucket
-