| @@ 4550-4591 (lines=42) @@ | ||
| 4547 | ||
| 4548 | return self._send_xml_command(cmd) |
|
| 4549 | ||
| 4550 | def modify_filter( |
|
| 4551 | self, filter_id, *, comment=None, name=None, term=None, filter_type=None |
|
| 4552 | ): |
|
| 4553 | """Modifies an existing filter. |
|
| 4554 | ||
| 4555 | Arguments: |
|
| 4556 | filter_id (str): UUID of the filter to be modified |
|
| 4557 | comment (str, optional): Comment on filter. |
|
| 4558 | name (str, optional): Name of filter. |
|
| 4559 | term (str, optional): Filter term. |
|
| 4560 | filter_type (str, optional): Resource type filter applies to. |
|
| 4561 | ||
| 4562 | Returns: |
|
| 4563 | The response. See :py:meth:`send_command` for details. |
|
| 4564 | """ |
|
| 4565 | if not filter_id: |
|
| 4566 | raise RequiredArgument( |
|
| 4567 | "modify_filter requires a filter_id " "attribute" |
|
| 4568 | ) |
|
| 4569 | ||
| 4570 | cmd = XmlCommand("modify_filter") |
|
| 4571 | cmd.set_attribute("filter_id", filter_id) |
|
| 4572 | ||
| 4573 | if comment: |
|
| 4574 | cmd.add_element("comment", comment) |
|
| 4575 | ||
| 4576 | if name: |
|
| 4577 | cmd.add_element("name", name) |
|
| 4578 | ||
| 4579 | if term: |
|
| 4580 | cmd.add_element("term", term) |
|
| 4581 | ||
| 4582 | if filter_type: |
|
| 4583 | filter_type = filter_type.lower() |
|
| 4584 | if filter_type not in FILTER_TYPES: |
|
| 4585 | raise InvalidArgument( |
|
| 4586 | "modify_filter requires type to be one of {0} but " |
|
| 4587 | "was {1}".format(", ".join(FILTER_TYPES), filter_type) |
|
| 4588 | ) |
|
| 4589 | cmd.add_element("type", filter_type) |
|
| 4590 | ||
| 4591 | return self._send_xml_command(cmd) |
|
| 4592 | ||
| 4593 | def modify_group(self, group_id, *, comment=None, name=None, users=None): |
|
| 4594 | """Modifies an existing group. |
|
| @@ 866-906 (lines=41) @@ | ||
| 863 | ||
| 864 | return self._send_xml_command(cmd) |
|
| 865 | ||
| 866 | def modify_filter( |
|
| 867 | self, filter_id, *, comment=None, name=None, term=None, filter_type=None |
|
| 868 | ): |
|
| 869 | """Modifies an existing filter. |
|
| 870 | ||
| 871 | Arguments: |
|
| 872 | filter_id (str): UUID of the filter to be modified |
|
| 873 | comment (str, optional): Comment on filter. |
|
| 874 | name (str, optional): Name of filter. |
|
| 875 | term (str, optional): Filter term. |
|
| 876 | filter_type (FilterType, optional): Resource type filter applies to. |
|
| 877 | ||
| 878 | Returns: |
|
| 879 | The response. See :py:meth:`send_command` for details. |
|
| 880 | """ |
|
| 881 | if not filter_id: |
|
| 882 | raise RequiredArgument( |
|
| 883 | "modify_filter requires a filter_id " "attribute" |
|
| 884 | ) |
|
| 885 | ||
| 886 | cmd = XmlCommand("modify_filter") |
|
| 887 | cmd.set_attribute("filter_id", filter_id) |
|
| 888 | ||
| 889 | if comment: |
|
| 890 | cmd.add_element("comment", comment) |
|
| 891 | ||
| 892 | if name: |
|
| 893 | cmd.add_element("name", name) |
|
| 894 | ||
| 895 | if term: |
|
| 896 | cmd.add_element("term", term) |
|
| 897 | ||
| 898 | if filter_type: |
|
| 899 | if not isinstance(filter_type, FilterType): |
|
| 900 | raise InvalidArgument( |
|
| 901 | "modify_filter requires type to be a FilterType instance. " |
|
| 902 | "was {}".format(filter_type) |
|
| 903 | ) |
|
| 904 | cmd.add_element("type", filter_type.value) |
|
| 905 | ||
| 906 | return self._send_xml_command(cmd) |
|
| 907 | ||
| 908 | def create_target( |
|
| 909 | self, |
|