Search code examples
google-cloud-platformgcloudgoogle-cloud-iam

GCP Python SDK - Enable APIs without gcloud


I have used the documentation here https://cloud.google.com/endpoints/docs/frameworks/enable-api#gcloud to enable new APIs via the gcloud CLI tool. I have a service account with the owner role over my project, is it possible from within the python SDK, to enable APIs without using gcloud? Or, is it possible to call the gcloud CLI tool from the python SDK?


Solution

  • You can by using the discovery API client library for Service Usage API

    You can also perform an authenticated call to the Service Usage API enable service endpoint

    Let me know if you have issues and you want code example.