Dear all forumers, My devops team had created a google cloud storage space where I will upload HTML file to the bucket. I wonder where I can find such guide on Java code.
public void uploadFile() {
try {
// butv3
Storage storage = StorageOptions.newBuilder().setProjectId(projectId).build().getService();
BlobId blobId = BlobId.of(bucketName, butv3ObjectName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build();
storage.createFrom(blobInfo, Paths.get(butv3FilePath));
}
}
The machine that I run on MacOS saying that com.google.cloud.storage.StorageException: 401 Unauthorized.
Caused by: com.google.api.client.http.HttpResponseException: 401 Unauthorized
Please help. Thanks.