google cloud storage 如何获取下载的链接

如何获取文件下载的链接
我参照官方链接,进行的开发
https://cloud.google.com/storage/docs/access-control/signing-urls-with-helpers#storage-signed-url-object-java

但是后来发现这个方法是做了一个上传的链接,不符合我的业务需要
Storage.SignUrlOption.withV4Signature() 这个我也不是很明白(根据官方文档描述,链接最长7天)
我的业务需要一个可以下载的链接,而且可以设定链接的有效时长(下载的链接有效时长,可达几年)

求解


```java
 public static void generateV4GetObjectSignedUrl(
      String projectId, String bucketName, String objectName) throws StorageException {
    // String projectId = "my-project-id";
    // String bucketName = "my-bucket";
    // String objectName = "my-object";

    Storage storage = StorageOptions.newBuilder().setProjectId(projectId).build().getService();

    // Define resource
    BlobInfo blobInfo = BlobInfo.newBuilder(BlobId.of(bucketName, objectName)).build();

    URL url =
        storage.signUrl(blobInfo, 15, TimeUnit.MINUTES, Storage.SignUrlOption.withV4Signature());

    System.out.println("Generated GET signed URL:");
    System.out.println(url);
    System.out.println("You can use this URL with any user agent, for example:");
    System.out.println("curl '" + url + "'");
  }

```

Google云端存储提供了一种称为“已签名网址”的功能,这就是您所描述的功能:只需短时间下载单个文件的网址即可。我们的想法是您制作下载URL,然后使用服务帐户的私钥来“签名”该URL。持有该最终URL的任何人都可以使用它作为该服务帐户来下载该一个对象。