Search in sources :

Example 1 with RolesService

use of org.ovirt.engine.sdk4.services.RolesService in project ovirt-engine-sdk-java by oVirt.

the class ListRoles method main.

public static void main(String[] args) throws Exception {
    // Create the connection to the server:
    Connection connection = connection().url("https://engine41.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
    // Get the reference to the service that manages the roles:
    RolesService rolesService = connection.systemService().rolesService();
    // Retrieve the roles:
    List<Role> roles = rolesService.list().send().roles();
    // For each role print its name and description:
    for (Role role : roles) {
        System.out.printf("%s: %s\n", role.name(), role.description());
    }
    // Close the connection to the server:
    connection.close();
}
Also used : Role(org.ovirt.engine.sdk4.types.Role) RolesService(org.ovirt.engine.sdk4.services.RolesService) Connection(org.ovirt.engine.sdk4.Connection)

Aggregations

Connection (org.ovirt.engine.sdk4.Connection)1 RolesService (org.ovirt.engine.sdk4.services.RolesService)1 Role (org.ovirt.engine.sdk4.types.Role)1