Ticket
- class Ticket(api)
Bases:
FeatureBase
- create(obj, workflow, approvers, reason, user_data=None)
Creates a workflow ticket on
obj
only if the object is in a state to received a workflow ticket.- Parameters
obj (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the object requiring a workflow ticket.
workflow (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the workflow object.
approvers (Union[List[ident.Identity], List[str]]) – List of Identity Object or Prefixed Name for each approver.
reason (Union[RC, int, str]) –
RC
or integer reason code.user_data (str) – User data.
- Returns
Workflow ticket name.
- Return type
str
- delete(ticket_name)
Deletes a workflow ticket.
- Parameters
ticket_name (str) – Name of the workflow ticket.
- details(ticket_name)
Returns the details of a ticket request.
- Parameters
ticket_name (str) – Name of the workflow ticket.
- Returns
Details
of the workflow ticket.
- exists(ticket_name)
- Parameters
ticket_name (str) – Name of the workflow ticket.
- Returns
True
when a particular workflow exists, otherwiseFalse
.- Return type
bool
- get(obj=None, user_data=None, expected_num_tickets=1, timeout=10)
Gets all tickets associated to
obj
. If the minimum expected number of tickets do not appear on theobj
, then a warning is logged and whatever was found is returned and no error is raised.- Parameters
obj (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the object with a workflow ticket issued to it. If not given, only
user_data
has effect.user_data (str) – The string to filter results using the User Data attribute of the workflow ticket.
expected_num_tickets (int) – Minimum number of tickets expected to be written for the certificate.
timeout (int) – Time in seconds to wait for a ticket to be issued. Default is 10 seconds.
- Returns
List of GUID for each ticket found.
- status(ticket_name)
- Parameters
ticket_name (str) – Name of the workflow ticket.
- Returns
The current status of a workflow ticket.
- Return type
str
- update_status(ticket_name, status, explanation=None, scheduled_start=None, scheduled_stop=None)
Updates the status of a workflow ticket with the optional explanations and scheduled approvals. Marking a ticket as “Approved” will automatically delete the ticket.
- Parameters
ticket_name (str) – Name of the workflow ticket.
status (str) – The new status of the workflow ticket.
explanation (str) – Reason for the new status.
scheduled_start (datetime) – Datetime to continue the approval process.
scheduled_stop (datetime) – Datetime to expire the approval process.