Package com.adobe.testing.s3mock
Class BucketController
java.lang.Object
com.adobe.testing.s3mock.BucketController
@CrossOrigin(origins="*",
exposedHeaders="*")
@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.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<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
@RequestMapping(value="/", method=GET, produces="application/xml") public org.springframework.http.ResponseEntity<ListAllMyBucketsResult> listBuckets()List all existing buckets. API Reference- Returns:
- List of all Buckets
-
createBucket
@RequestMapping(value="/{bucketName:.+}", params={"!object-lock","!lifecycle"}, method=PUT) 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:.+}", 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
@RequestMapping(value="/{bucketName:.+}", params="!lifecycle", method=DELETE) 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
@RequestMapping(value="/{bucketName:.+}", params={"object-lock","!list-type"}, method=GET, 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
@RequestMapping(value="/{bucketName:.+}", params="object-lock", method=PUT, 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
@RequestMapping(value="/{bucketName:.+}", params={"lifecycle","!list-type"}, method=GET, 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
@RequestMapping(value="/{bucketName:.+}", params="lifecycle", method=PUT, 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
@RequestMapping(value="/{bucketName:.+}", params="lifecycle", method=DELETE) 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
@RequestMapping(value="/{bucketName:.+}", params="location", method=GET) 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
@RequestMapping(params={"!uploads","!object-lock","!list-type","!lifecycle","!location"}, value="/{bucketName:.+}", method=GET, produces="application/xml") @Deprecated 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.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
@RequestMapping(value="/{bucketName:.+}", params="list-type=2", method=GET, 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
-