You need to produce a list of the enabled Google Cloud Platform APIs for a GCP project using the gcloud command line in the Cloud Shell. The project name is my-project. What should you do?
A.
Run gcloud projects list to get the project ID, and then run gcloud services list --project <project ID>.
B.
Run gcloud init to set the current project to my-project, and then run gcloud services list --available.
C.
Run gcloud info to view the account value, and then run gcloud services list --account <Account>.
D.
Run gcloud projects describe <project ID> to verify the project value, and then run gcloud services list --available.
A is the correct answer, log to gcloud and run the commands, doesnt make sense to run cloud init and gcloud services list --available gives you the full services that are available.
"A" is correct.
For those, who have doubts:
`gcloud services list --available` returns not only the enabled services in the project but also services that CAN be enabled. Therefore, option B is incorrect.
https://cloud.google.com/sdk/gcloud/reference/services/list#--available
Let's do a side-by-side analysis of Answer A and Answer D to clear our doubts:
Answer A: Run gcloud projects list to get the project ID, and then run gcloud services list --project <project ID>.
This option first retrieves the project ID by running the gcloud projects list command.
Then, it uses the gcloud services list command with the --project flag to list the enabled APIs for the specified project.
Answer D: Run gcloud projects describe <project ID> to verify the project value, and then run gcloud services list --available.
This option uses the gcloud projects describe command with the project ID to retrieve information about the specified project, including the project ID.
Then, it uses the gcloud services list command with the --available flag to list all available APIs, not just the ones that are enabled for the specified project.
Based on the scenario presented in the question, we want to produce a list of the enabled APIs for a GCP project, NOT a list of all available APIs. Therefore, Answer A is more appropriate because it specifically lists the enabled APIs for the specified project.
Answer D lists all available APIs which may include APIs that are not enabled in the project, which could cause confusion or unnecessary information.
Therefore, Answer A is the correct option in this case.
D. Run gcloud projects describe <project ID> to verify the project value, and then run gcloud services list --available.
To produce a list of enabled Google Cloud Platform APIs for a GCP project using the gcloud command line, you can first run gcloud projects describe <project ID> to verify the project ID for the project in question. Then, you can run gcloud services list --available to list all the available APIs and see which ones are enabled for the project. This command shows the full list of services and their status, including whether they are enabled, disabled, or ready for use. Option A is incorrect because it lists all the available services, regardless of whether they are enabled or not. Option B is incorrect because it lists only the available services, which might not be enabled in the project. Option C is incorrect because it shows account information and not service information.
A is correct answer,
Run the following command to list the enabled APIs and services in your current project:
gcloud services list
whereas, Run the following command to list the APIs and services available to you in your current project:
gcloud services list --available
A is the correct answer.
https://cloud.google.com/sdk/gcloud/reference/services/list#--available
--available
Return the services available to the project to enable. This list will include any services that the project has already enabled.
To list the services the current project has enabled for consumption, run:
gcloud services list --enabled
To list the services the current project can enable for consumption, run:
gcloud services list --available
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
dan80
Highly Voted 4 years, 2 months agoraffiq
4 years, 2 months agolxgywil
Highly Voted 3 years, 3 months agosquishy_fishy
3 years, 2 months agopzacariasf7
Most Recent 5 months, 3 weeks agosabrinakloud
1 year, 4 months agoBuruguduystunstugudunstuy
1 year, 6 months agoBuruguduystunstugudunstuy
1 year, 6 months agoBobbybash
1 year, 6 months agoCharumathi
1 year, 11 months agoAzureDP900
2 years, 2 months agoharoldbenites
2 years, 3 months agoluciorifa
2 years, 6 months agosharmaishu
2 years, 6 months ago[Removed]
2 years, 8 months agovishnukumartr
2 years, 9 months agoshawnkkk
2 years, 9 months agoLitan
2 years, 11 months agomcaromit
3 years, 3 months agoRabbitfur
3 years, 4 months ago