Get Google Cloud Project Number using its Id

Dmitry Gorkovets :

I have Google Cloud Service account and projectId and want to get projectNumber programmatically from Java.

enter image description here

How can I get it?

Basically I have Service Account and want to use it for granting role "roles/storage.legacyBucketWriter" for the account "[email protected]" in the Google Cloud Storage Bucket.

Lee :

I think GCP did not provide an API to map a project ID to a project number. But they did provide a project list API, after you get the list of the projects. You can map the project number by yourself.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=112299&siteId=1