简体   繁体   中英

How to list all app services in google cloud platform using python API

I'm trying to write a simple python code to list out the app services in google-cloud-platform , In command prompt i'm able to list it by passing the below command

gcloud app services list

When i searched in stack overflow and other websites i couldn't find any piece of code that can list me app services . Any information related this will be thankful. Thanks in advance

One possibility is to use the Admin API , for example by making HTTP requests to its REST apps.services.list method :

Lists all the services in the application.

HTTP request

 GET https://appengine.googleapis.com/v1beta/{parent=apps/*}/services 

Or you can always fallback to plain invoking from your python code the same commands that you can run manually and process their outputs, for example via subprocess.Popen() .

As you have mentioned that you were unable to find a proper documentation to list out the services or the versions for an application in the Google Cloud Platform, for requests regarding documentation modification you can definitely provide a feedback on the documentation page and we would definitely provide as much information as possible.

Regarding the question, I would have to agree with the previously mentioned solution posted by Mr. Dan Cornilescu, also for further clarification you would be able to call the Admin API that would create a HTTP requests to the REST and provide the List of services of an application. On the top of that you can also request a call to List of versions under the service of an application. 提供参数

Over there if you could provide the requested parameters under the parent section (for your case your application name after 'app/') and execute (at the bottom) the call using your preferred authentication to request the list of services.

试试这个程序

You can also click on the icon on the top right corner to able to go to following page where it provides the functions and the method calls in JavaScript. We would try our best to update the calls in Python as well. Thank you so much.

JavaScript API代码

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM