Google Cloud Professional Cloud Developer — Question 150
Your operations team has asked you to create a script that lists the Cloud Bigtable, Memorystore, and Cloud SQL databases running within a project. The script should allow users to submit a filter expression to limit the results presented. How should you retrieve the data?
Answer options
- A. Use the HBase API, Redis API, and MySQL connection to retrieve database lists. Combine the results, and then apply the filter to display the results
- B. Use the HBase API, Redis API, and MySQL connection to retrieve database lists. Filter the results individually, and then combine them to display the results
- C. Run gcloud bigtable instances list, gcloud redis instances list, and gcloud sql databases list. Use a filter within the application, and then display the results
- D. Run gcloud bigtable instances list, gcloud redis instances list, and gcloud sql databases list. Use --filter flag with each command, and then display the results
Correct answer: D
Explanation
The correct answer is D because using the --filter flag with each gcloud command allows for effective filtering at the source level, ensuring only relevant results are returned directly from the commands. Options A and B involve merging lists after filtering, which is less efficient and unnecessarily complicates the process. Option C suggests filtering within the application, which does not utilize the filtering capabilities of the gcloud command-line tools.