@@ 928-975 (lines=48) @@ | ||
925 | ||
926 | return self._send_xml_command(cmd) |
|
927 | ||
928 | def modify_filter( |
|
929 | self, |
|
930 | filter_id: str, |
|
931 | *, |
|
932 | comment: Optional[str] = None, |
|
933 | name: Optional[str] = None, |
|
934 | term: Optional[str] = None, |
|
935 | filter_type: Optional[FilterType] = None |
|
936 | ) -> Any: |
|
937 | """Modifies an existing filter. |
|
938 | ||
939 | Arguments: |
|
940 | filter_id: UUID of the filter to be modified |
|
941 | comment: Comment on filter. |
|
942 | name: Name of filter. |
|
943 | term: Filter term. |
|
944 | filter_type: Resource type filter applies to. |
|
945 | ||
946 | Returns: |
|
947 | The response. See :py:meth:`send_command` for details. |
|
948 | """ |
|
949 | if not filter_id: |
|
950 | raise RequiredArgument( |
|
951 | function=self.modify_filter.__name__, argument='filter_id' |
|
952 | ) |
|
953 | ||
954 | cmd = XmlCommand("modify_filter") |
|
955 | cmd.set_attribute("filter_id", filter_id) |
|
956 | ||
957 | if comment: |
|
958 | cmd.add_element("comment", comment) |
|
959 | ||
960 | if name: |
|
961 | cmd.add_element("name", name) |
|
962 | ||
963 | if term: |
|
964 | cmd.add_element("term", term) |
|
965 | ||
966 | if filter_type: |
|
967 | if not isinstance(filter_type, self.types.FilterType): |
|
968 | raise InvalidArgumentType( |
|
969 | function=self.modify_filter.__name__, |
|
970 | argument='filter_type', |
|
971 | arg_type=FilterType.__name__, |
|
972 | ) |
|
973 | cmd.add_element("type", filter_type.value) |
|
974 | ||
975 | return self._send_xml_command(cmd) |
|
976 | ||
977 | def create_schedule( |
|
978 | self, |
|
@@ 883-926 (lines=44) @@ | ||
880 | ||
881 | return self._send_xml_command(cmd) |
|
882 | ||
883 | def create_filter( |
|
884 | self, |
|
885 | name: str, |
|
886 | *, |
|
887 | filter_type: Optional[FilterType] = None, |
|
888 | comment: Optional[str] = None, |
|
889 | term: Optional[str] = None |
|
890 | ) -> Any: |
|
891 | """Create a new filter |
|
892 | ||
893 | Arguments: |
|
894 | name: Name of the new filter |
|
895 | filter_type: Filter for entity type |
|
896 | comment: Comment for the filter |
|
897 | term: Filter term e.g. 'name=foo' |
|
898 | ||
899 | Returns: |
|
900 | The response. See :py:meth:`send_command` for details. |
|
901 | """ |
|
902 | if not name: |
|
903 | raise RequiredArgument( |
|
904 | function=self.create_filter.__name__, argument="name" |
|
905 | ) |
|
906 | ||
907 | cmd = XmlCommand("create_filter") |
|
908 | _xmlname = cmd.add_element("name", name) |
|
909 | ||
910 | if comment: |
|
911 | cmd.add_element("comment", comment) |
|
912 | ||
913 | if term: |
|
914 | cmd.add_element("term", term) |
|
915 | ||
916 | if filter_type: |
|
917 | if not isinstance(filter_type, self.types.FilterType): |
|
918 | raise InvalidArgumentType( |
|
919 | function=self.create_filter.__name__, |
|
920 | argument="filter_type", |
|
921 | arg_type=self.types.FilterType.__name__, |
|
922 | ) |
|
923 | ||
924 | cmd.add_element("type", filter_type.value) |
|
925 | ||
926 | return self._send_xml_command(cmd) |
|
927 | ||
928 | def modify_filter( |
|
929 | self, |
@@ 734-782 (lines=49) @@ | ||
731 | cmd.add_element("copy", credential_id) |
|
732 | return self._send_xml_command(cmd) |
|
733 | ||
734 | def create_filter( |
|
735 | self, |
|
736 | name: str, |
|
737 | *, |
|
738 | make_unique: Optional[bool] = None, |
|
739 | filter_type: Optional[FilterType] = None, |
|
740 | comment: Optional[str] = None, |
|
741 | term: Optional[str] = None |
|
742 | ) -> Any: |
|
743 | """Create a new filter |
|
744 | ||
745 | Arguments: |
|
746 | name: Name of the new filter |
|
747 | make_unique: |
|
748 | filter_type: Filter for entity type |
|
749 | comment: Comment for the filter |
|
750 | term: Filter term e.g. 'name=foo' |
|
751 | ||
752 | Returns: |
|
753 | The response. See :py:meth:`send_command` for details. |
|
754 | """ |
|
755 | if not name: |
|
756 | raise RequiredArgument( |
|
757 | function=self.create_filter.__name__, argument="name" |
|
758 | ) |
|
759 | ||
760 | cmd = XmlCommand("create_filter") |
|
761 | _xmlname = cmd.add_element("name", name) |
|
762 | ||
763 | if comment: |
|
764 | cmd.add_element("comment", comment) |
|
765 | ||
766 | if term: |
|
767 | cmd.add_element("term", term) |
|
768 | ||
769 | if make_unique is not None: |
|
770 | cmd.add_element("make_unique", _to_bool(make_unique)) |
|
771 | ||
772 | if filter_type: |
|
773 | if not isinstance(filter_type, self.types.FilterType): |
|
774 | raise InvalidArgumentType( |
|
775 | function=self.create_filter.__name__, |
|
776 | argument="filter_type", |
|
777 | arg_type=self.types.FilterType.__name__, |
|
778 | ) |
|
779 | ||
780 | cmd.add_element("type", filter_type.value) |
|
781 | ||
782 | return self._send_xml_command(cmd) |
|
783 | ||
784 | def clone_filter(self, filter_id: str) -> Any: |
|
785 | """Clone an existing filter |
|
@@ 4887-4934 (lines=48) @@ | ||
4884 | ||
4885 | return self._send_xml_command(cmd) |
|
4886 | ||
4887 | def modify_filter( |
|
4888 | self, |
|
4889 | filter_id: str, |
|
4890 | *, |
|
4891 | comment: Optional[str] = None, |
|
4892 | name: Optional[str] = None, |
|
4893 | term: Optional[str] = None, |
|
4894 | filter_type: Optional[FilterType] = None |
|
4895 | ) -> Any: |
|
4896 | """Modifies an existing filter. |
|
4897 | ||
4898 | Arguments: |
|
4899 | filter_id: UUID of the filter to be modified |
|
4900 | comment: Comment on filter. |
|
4901 | name: Name of filter. |
|
4902 | term: Filter term. |
|
4903 | filter_type: Filter type the filter applies to. |
|
4904 | ||
4905 | Returns: |
|
4906 | The response. See :py:meth:`send_command` for details. |
|
4907 | """ |
|
4908 | if not filter_id: |
|
4909 | raise RequiredArgument( |
|
4910 | function=self.modify_filter.__name__, argument='filter_id' |
|
4911 | ) |
|
4912 | ||
4913 | cmd = XmlCommand("modify_filter") |
|
4914 | cmd.set_attribute("filter_id", filter_id) |
|
4915 | ||
4916 | if comment: |
|
4917 | cmd.add_element("comment", comment) |
|
4918 | ||
4919 | if name: |
|
4920 | cmd.add_element("name", name) |
|
4921 | ||
4922 | if term: |
|
4923 | cmd.add_element("term", term) |
|
4924 | ||
4925 | if filter_type: |
|
4926 | if not isinstance(filter_type, self.types.FilterType): |
|
4927 | raise InvalidArgumentType( |
|
4928 | function=self.modify_filter.__name__, |
|
4929 | argument='filter_type', |
|
4930 | arg_type=self.types.FilterType.__name__, |
|
4931 | ) |
|
4932 | cmd.add_element("type", filter_type.value) |
|
4933 | ||
4934 | return self._send_xml_command(cmd) |
|
4935 | ||
4936 | def modify_group( |
|
4937 | self, |