awsc.base_control.generic_confirm_template
- awsc.base_control.generic_confirm_template(method, template, *args, provider, category, subcategory, resource_type, summary=None, custom_callback=None, refresh=True, resource_identifier=None, undoable=False, can_force=False, extra_fields=None, action_name='Delete', success_template=None, from_what=None, from_what_name=None, **kwargs)
Creates a confirmation sequence.
Returns a function that, when called, begins the confirmation process. The returned function requires no arguments, but takes any amount for legacy reasons.
- Parameters:
- methodstr
The name of the method to call for the provider when the action is confirmed.
- templateTemplateDict
A TemplateDict which describes the keyword arguments to pass to method.
- custom_callbackCallable, optional
A replacement callback for handling the confirmation.
- refreshbool, default: True
Whether to call refresh_data() after executing the action.
- categorystr
API call category, for logging purposes. Usually a pretty printed name for the AWS service that is being used.
- subcategorystr
API call subcategory, for logging purposes. Usually the type of the AWS resource being managed.
- providerstr
The name of the boto3 provider which contains the definition of the method.
- resource_typestr
The name of the type of resource being managed.
- resource_identifierstr, optional
Templatable via SelectionAttribute. Override for resource identifier if something other than the primary key of the current resource should be used.
- undoablebool, default: False
Cosmetic, to display a warning about data loss if not set to true.
- can_forcebool, default: False
Adds an additional force checkbox to the confirmation dialog if set. The value of this checkbox is passed as “force” to the callback, and can be represented by a ForceFlag object in the template.
- summarystr, optional
A short description of the action being performed for logging purposes. Defaults to a concatenation of action name and resource type (eg. ‘Delete EC2 instance’)
- extra_fieldsdict, optional
A map of additional fields to add to the confirmation dialog, where the key is the name of the field, and the value is a DialogField instance. These fields are then passed as keyword arguments to the callback, where the argument name is the key of the field in the dict. The value of extra fields can also be referred to via a FieldValue object in the template.
- action_namestr, default: “Delete”
The name of the action being performed if the dialog is confirmed. Defaults to ‘Delete’ as that is both the original purpose of confirmation dialogs and the most common action requiring a confirmation.
- success_templatestr, optional:
A formattable string that will be displayed as a message if the operation succeeds. The format method will be called on the string, where index 0, and the named field ‘resource’ will be available as arguments containing the resource primary key. All keyword arguments passed to the method will also be passed as-is to this invocation of format. Attempts to construct a grammatically correct but not particularly pleasing to read message if omitted.
- from_whatstr, optional
The from_what option of a DeleteResourceDialog.
- from_what_namestr, optional
Templatable via SelectionAttribute. The from_what_name option of a DeleteResourceDialog.
- Returns:
- callable
A function that, when called, begins the confirmation process.