Hi team ,
I am trying to create a virtual image from a tar file that is present in the storage bucket
well I am able to achieve this directly from UI & form this rest api call : Method: images.insert | Compute Engine | Google Cloud
req body :
{“name”:“alma-test-img”,“rawDisk”:{“source”:“https://storage.googleapis.com/${bucketname}/${filepath}/alma-test.raw.tar.gz”}}
But the same thing when tried from my Java SDK code which is my actual requirement
I get this
Required ‘read’ permission for ‘${filepath}/alma-test.raw.tar.gz’
well I have the required access as Project Owner , Storage Object Viewer , Storage Admin for my service account
ref code :
Image newImage = new Image()
newImage.setName(googleImageName)
Image.RawDisk rawDisk = new Image.RawDisk()
rawDisk.setSource(sourceUrl)
newImage.setRawDisk(rawDisk)
def scopes = new ArrayList()
scopes << ComputeScopes.COMPUTE
scopes << StorageScopes.DEVSTORAGE_READ_WRITE
computeClient = getGoogleComputeClient(opts.zone, scopes)
Compute.Images.Insert insertImage = computeClient.images().insert(projectId, newImage)
def insertResult = insertImage.execute()
The compute client which is used above is also used for other sdk calls which eventually works fine
Request help here if it was some kind of permission error the rest api shouldn’t have worked & if any explicit permissions are required at a service account level or at a storage bucket level