CloudBolt’s models are exposed through Django’s Object Relational Model, so understanding this ORM is key to effectively querying CloudBolt.
Model details can be found on your cb instance at
https://intance_ip/alladmin/doc/models/. While it doesn't necessarily provide details in how to use these models, it does provide good information about the objects that are available and their associated properties.
One thing to keep in mind when looking at these models: Custom Fields/Attributes are made available as dynamic properties. This means if I have a custom field called "my_custom_field" attached to a Server -- it will not show in this model documentation. It will however be available as server.my_custom_field (where the server is an instance of a Server object) at runtime and in shell_plus.
I’d like to get the documentation for the following code snippet:
from accounts.models import Group, Role, UserProfile, ExternalUserAttributeMapping
if you want to know all the functions for the UserProfile object, which is not available in model details
(https://intance_ip/alladmin/doc/models/)just follow the below steps:
a. ssh to your CB appliance
c. import object/method
UserProfileand give dot(.) then press the "tab" button, you will see all the function which is available for that object
e. if you won't pass any argument, it will throw an error message what all are the arguments for that function.
if you want to see a description of the method, you can use the
help(object) command in shell plus.
u = UserProfile.objects.last()
help(object) i.e help(u)
Include links to outside source articles or reference material if applicable