Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You are automating Google Cloud API lifecycle management for a project using the gcloud CLI and the Service Usage REST API. Earlier, your setup script ran gcloud services enable for a primary API, which automatically activated several underlying dependency APIs.
Your teardown script must now meet these requirements:
serviceusage.googleapis.com) enabled for future automation.When your script calls the services.disable endpoint for the foundational API, the request fails with an error.
How should you modify the teardown workflow to meet all requirements?
services.disable REST API request to set the disableDependentServices parameter to true, and run gcloud services list afterward to confirm which services remain enabled.disableDependentServices parameter and gcloud services list areThe Service Usage API manages the lifecycle of Google Cloud and third-party APIs within a project. By default, when you attempt to disable an API via the services.disable REST method while other enabled services rely on it, the request fails to prevent accidentally breaking dependent workloads. Setting the disableDependentServices parameter to true overrides this safeguard and cascades the disable operation to all dependent services. Afterward, running gcloud services list returns the active APIs currently enabled in the project.
disableDependentServices to true instructs the Service Usage API to deactivate both the target foundational service and every enabled service that depends on it in a single operation.serviceusage.googleapis.com enabled (provided it is not itself dependent on the target service), preserving programmatic access for future automation runs.gcloud services list (without the --available flag) outputs only the APIs currently in the ENABLED state for the project.curl.gcloud services operations describe to confirm completion.Attempting to disable dependent services manually one by one is error-prone as service dependency graphs evolve. Setting disableDependentServices to true directly resolves the dependency error within the services.disable call, and pairing it with gcloud services list provides immediate confirmation of the project's remaining active services.
services.disable API call with gcloud services enable, specifying only the APIs you want to retain in the project so that all unlisted dependent services are automatically deactivated.gcloud services enable doesThe gcloud services enable command activates one or more specified services in the current Google Cloud project. It accepts space-delimited service names (such as bigquery.googleapis.com pubsub.googleapis.com) and automatically enables any underlying prerequisite APIs that the specified services depend on.
gcloud services enable is strictly additive; it activates the listed services and their dependencies without turning off any previously enabled services that are omitted from the command.gcloud services disable or the Service Usage services.disable REST method.gcloud services enable has no effect on that service's enabled state.gcloud services disable SERVICE.Using gcloud services enable with space-delimited service names would be the right solution during environment provisioning, when you want to script the activation of multiple APIs in a project and automatically enable any prerequisite services they depend on.
roles/serviceusage.serviceUsageViewer) and run gcloud services list --available before retrying the services.disable request.roles/serviceusage.serviceUsageViewer and gcloud services list --available doThe Service Usage Viewer IAM role (roles/serviceusage.serviceUsageViewer) grants read-only access to inspect which services are enabled or available in a Google Cloud project, folder, or organization. Running gcloud services list --available retrieves all services available to be enabled in the current project, including both public Google Cloud services and private services shared with the caller.
serviceusage.services.enable and corresponding disable permissions, which are included in the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin) or Owner (roles/owner), not in the read-only Service Usage Viewer role.services.disable endpoint to cascade deactivation across dependent APIs.--available flag returns a large list of all services available to the project—both enabled and disabled—rather than filtering exclusively to the services that remain active.roles/serviceusage.serviceUsageViewer is intended strictly for listing and viewing service states.roles/serviceusage.serviceUsageAdmin is the standard predefined role for enabling and disabling services.--available returns substantially more data than listing enabled services and can take up to 30 seconds.--available in gcloud services list (or using filter=state:ENABLED in the REST API) is required to view only active services.Granting roles/serviceusage.serviceUsageViewer and running gcloud services list --available would be appropriate if an auditor or developer needed read-only access to discover all public and private APIs eligible to be enabled in a project.
serviceusage.googleapis.com) first so dependency checks are bypassed, then retry the services.disable request.The API Library in the Google Cloud console provides a graphical interface for browsing, enabling, and disabling APIs in a project. The Service Usage API (serviceusage.googleapis.com) is enabled by default on new Google Cloud projects and serves as the underlying control-plane API that processes requests to list, enable, and disable services.
serviceusage.googleapis.com does not bypass API dependency enforcement. Instead, any subsequent call to the Service Usage API—including services.disable—from that project fails with an error until the API is re-enabled.serviceusage.googleapis.com active for future automation scripts.serviceusage.googleapis.com, the services.disable request will still fail unless dependent services are disabled first or disableDependentServices is set to true.serviceusage.googleapis.com to be enabled on the project performing the request.serviceusage.googleapis.com is accidentally disabled, it must be re-enabled through the Google Cloud console or the gcloud CLI before API calls succeed again.Using the Google Cloud console API Library (or the gcloud CLI) to manage serviceusage.googleapis.com would be the right solution if someone had previously disabled the Service Usage API on the project and you needed to re-enable it so programmatic API management requests could run again.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated