Where is gcloud cli source code?

I can not find it in the Google Search, Github.

gcloud asset search-all-resources --scope=projects/affable-framing-474410-n8 --query="state:RUNNING OR state:RUNNABLE OR state:ACTIVE"

I want to know state all values, but search-all-resources don’t show all values.

Howdy @anlex_N ,

gcloud CLI source code is not published as open-source so we don’t have access to it ( it’s different story as with AWS CLI, which is public. )

cheers,
Damian | GDE Cloud

Thank you for your reply, you are my friend!

So do you know state all values?

@anlex_N,

No. I don’t. And the reason is that there is no single global list of states. This state field is not standardized across Google Cloud. Each individual API returned their status itself.

What you could do is to search everything in a project and print only UNIQUE states that exists

gcloud asset search-all-resources \
  --scope=projects/PROJECT_ID \
  --format="value(state)" \
  | sort | uniq

so the output will be

gcloud asset search-all-resources   --scope=projects/PROJECT_ID   --format=“value(state)”   | sort | uniq

ACTIVE
ENABLED
VERIFICATION_STATUS_UNSPECIFIED

Be sure to mark one of this reply as solution if I’ve helped.

cheers,
Damian

If I dont create project in the Google Cloud, how to get state all values?

What you can do is to search everything either in a **:

  1. Project
  2. Folder
  3. Organization
    **
    So if you didn’t configured Organization and folders AND you also didn’t created any single project, you will not be able to list states.
1 Like

@DamianS thank you, you are my (PII Removed by Staf) friend.

I hope Google Team can open gcloud cli source code. AWS/AZure have opened their source codes.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.