-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manager App v2/v3 shows PCF title services #65
Comments
Which services are you referring to? Service bindings, instances or services? About the pagination limit, I have not tested it with great number of page but I assume this should work. About fixing the space and org, do you mean like the cf cli? If so there is not. This is a library meant to interract with the CF API. However, you can do things like (given you want to load all applications of a org/space ) for app in client.v2.apps.list(space_guid='space-id', organization_guid='org-id'):
pass Entities returned by client wrap all the urls returned as a method Exemple of an application: {
"metadata": {
"guid": "6064d98a-95e6-400b-bc03-be65e6d59622",
"url": "/v2/apps/6064d98a-95e6-400b-bc03-be65e6d59622",
"created_at": "2016-06-08T16:41:45Z",
"updated_at": "2016-06-08T16:41:45Z"
},
"entity": {
"name": "name-2443",
/* ... */
"space_url": "/v2/spaces/9c5c8a91-a728-4608-9f5e-6c8026c3a2ac",
"stack_url": "/v2/stacks/f6c960cc-98ba-4fd1-b197-ecbf39108aa2",
"routes_url": "/v2/apps/6064d98a-95e6-400b-bc03-be65e6d59622/routes",
"events_url": "/v2/apps/6064d98a-95e6-400b-bc03-be65e6d59622/events",
"service_bindings_url": "/v2/apps/6064d98a-95e6-400b-bc03-be65e6d59622/service_bindings",
"route_mappings_url": "/v2/apps/6064d98a-95e6-400b-bc03-be65e6d59622/route_mappings"
}
} will result to an object having extra methods such as
If you take a look at the application class, you will see that it has extra methods (start, stop and so on) So, you can for a given application do app = client.v2.apps['app-guid' ] # similar to client.v2.apps.get('app-guid')
app_service_bindings = [ s for s in app.service_bindings() ]
# or if you don't care about the application object
app_service_bindings = [ s for s in client.v2.apps.list_service_bindings('app-guid') ]
# then you can resolve service instances
app_service_instances = [ s.service_instance() for s in app_service_bindings ]
# then from service instance you load service plans
app_service_plans = [ s.service_plan() for s in app_service_instances ]
# and then the service
app_services = [ s.service() for s in app_service_plans ] Take a look at the v2 documentation or the v3 documentation. If you see an entry that does not exist I will gladly implement it. I hope you found answers |
Thank you very much for helping me out with this. Definitely it helps me to get more clarity. You guys have done a pretty awesome job. Here is the actual code snippet that I'm slowly working on with all the data available. So the far the objects are to retrieve app-name, db-host and export them to csv. import os init with user credentialsclient.init_with_user_credentials('username', 'password') init with refresh token (that will retrieve a fresh access token)print("Displaying all available Organization guid available") Setting scope to an specific org/spaceprint ("Setting Up space") Iterating over the list of apps available per space/orgfor app in target_space_apps: |
I'm very new to Python as you might note. So any constructive critics will be taken pretty positive. |
Hi I couldn't find documentation on how to retrieves services attached to an specific app.
The text was updated successfully, but these errors were encountered: