magpie.api.management.service.service_formats
¶
Module Contents¶
Functions¶
|
Formats the |
|
Formats the service and its children resource tree as a JSON body. |
|
-
magpie.api.management.service.service_formats.
format_service
(service: magpie.models.Service, permissions: Optional[List[PermissionSet]] = None, permission_type: Optional[PermissionType] = None, show_private_url: bool = False, show_resources_allowed: bool = False, show_configuration: bool = False, basic_info: bool = False) → magpie.typedefs.JSON[source]¶ Formats the
service
information into JSON.- Note:
Automatically finds
permissions
of the service if not specified. To preserve empty permissions such as during listing of user/group resource permissions, an emptylist
should be specified.
-
magpie.api.management.service.service_formats.
format_service_resources
(service: magpie.models.Service, db_session: sqlalchemy.orm.session.Session, service_perms: Optional[List[PermissionSet]] = None, resources_perms_dict: Optional[ResourcePermissionMap] = None, permission_type: Optional[PermissionType] = None, show_all_children: bool = False, show_private_url: bool = True) → magpie.typedefs.JSON[source]¶ Formats the service and its children resource tree as a JSON body.
- Parameters
service – service for which to display details with sub-resources
db_session – database session
service_perms – If provided, sets Applied Permissions to display on the formatted
service
. Otherwise, sets the Allowed Permissions specific to theservice
’s type.resources_perms_dict – If provided (not
None
), set the Applied Permissions on each specified resource matched by ID. IfNone
, retrieve and set Allowed Permissions for the corresponding resources under the service. To set empty Applied Permissions (e.g.: User doesn’t have permissions on that resource), provide an explicit empty dictionary instead.permission_type – Provide permission type being rendered.
show_all_children – Display all children resources recursively, or only ones specified by ID with
resources_perms_dict
.show_private_url – displays the
- Returns
JSON body representation of the service resource tree