Class S3BucketLinkBuilderLocal

java.lang.Object
com.example.blogs.app.storage.S3BucketLinkBuilderLocal
All Implemented Interfaces:
FileLinkBuilder

@Service @Profile("local") public class S3BucketLinkBuilderLocal extends Object implements FileLinkBuilder
Builds S3 file access links by combining base URL, bucket name, and file metadata.
  • Constructor Details

    • S3BucketLinkBuilderLocal

      public S3BucketLinkBuilderLocal(@Value("${aws.endpoint}") String awsEndpoint, @Value("${aws.s3.bucket-name}") String bucketName)
      Constructs S3 link builder with resolved base URL and bucket configuration.
      Parameters:
      awsEndpoint - optional custom AWS endpoint
      bucketName - the S3 bucket name
  • Method Details

    • buildLink

      public String buildLink(String filePath, String uuid, String fileExtension)
      Builds a complete S3 URL for accessing a file. Combines base URL, bucket name, file path, UUID, and extension.
      Specified by:
      buildLink in interface FileLinkBuilder
      Parameters:
      filePath - the storage path of the file
      uuid - the unique identifier of the file
      fileExtension - the file extension including the dot (e.g., ".png")
      Returns:
      the complete S3 file access URL