@@ 739-787 (lines=49) @@ | ||
736 | cmd.add_element("copy", credential_id) |
|
737 | return self._send_xml_command(cmd) |
|
738 | ||
739 | def create_filter( |
|
740 | self, |
|
741 | name: str, |
|
742 | *, |
|
743 | make_unique: Optional[bool] = None, |
|
744 | filter_type: Optional[FilterType] = None, |
|
745 | comment: Optional[str] = None, |
|
746 | term: Optional[str] = None, |
|
747 | ) -> Any: |
|
748 | """Create a new filter |
|
749 | ||
750 | Arguments: |
|
751 | name: Name of the new filter |
|
752 | make_unique: |
|
753 | filter_type: Filter for entity type |
|
754 | comment: Comment for the filter |
|
755 | term: Filter term e.g. 'name=foo' |
|
756 | ||
757 | Returns: |
|
758 | The response. See :py:meth:`send_command` for details. |
|
759 | """ |
|
760 | if not name: |
|
761 | raise RequiredArgument( |
|
762 | function=self.create_filter.__name__, argument="name" |
|
763 | ) |
|
764 | ||
765 | cmd = XmlCommand("create_filter") |
|
766 | _xmlname = cmd.add_element("name", name) |
|
767 | ||
768 | if comment: |
|
769 | cmd.add_element("comment", comment) |
|
770 | ||
771 | if term: |
|
772 | cmd.add_element("term", term) |
|
773 | ||
774 | if make_unique is not None: |
|
775 | cmd.add_element("make_unique", _to_bool(make_unique)) |
|
776 | ||
777 | if filter_type: |
|
778 | if not isinstance(filter_type, self.types.FilterType): |
|
779 | raise InvalidArgumentType( |
|
780 | function=self.create_filter.__name__, |
|
781 | argument="filter_type", |
|
782 | arg_type=self.types.FilterType.__name__, |
|
783 | ) |
|
784 | ||
785 | cmd.add_element("type", filter_type.value) |
|
786 | ||
787 | return self._send_xml_command(cmd) |
|
788 | ||
789 | def clone_filter(self, filter_id: str) -> Any: |
|
790 | """Clone an existing filter |
|
@@ 5013-5060 (lines=48) @@ | ||
5010 | ||
5011 | return self._send_xml_command(cmd) |
|
5012 | ||
5013 | def modify_filter( |
|
5014 | self, |
|
5015 | filter_id: str, |
|
5016 | *, |
|
5017 | comment: Optional[str] = None, |
|
5018 | name: Optional[str] = None, |
|
5019 | term: Optional[str] = None, |
|
5020 | filter_type: Optional[FilterType] = None, |
|
5021 | ) -> Any: |
|
5022 | """Modifies an existing filter. |
|
5023 | ||
5024 | Arguments: |
|
5025 | filter_id: UUID of the filter to be modified |
|
5026 | comment: Comment on filter. |
|
5027 | name: Name of filter. |
|
5028 | term: Filter term. |
|
5029 | filter_type: Filter type the filter applies to. |
|
5030 | ||
5031 | Returns: |
|
5032 | The response. See :py:meth:`send_command` for details. |
|
5033 | """ |
|
5034 | if not filter_id: |
|
5035 | raise RequiredArgument( |
|
5036 | function=self.modify_filter.__name__, argument='filter_id' |
|
5037 | ) |
|
5038 | ||
5039 | cmd = XmlCommand("modify_filter") |
|
5040 | cmd.set_attribute("filter_id", filter_id) |
|
5041 | ||
5042 | if comment: |
|
5043 | cmd.add_element("comment", comment) |
|
5044 | ||
5045 | if name: |
|
5046 | cmd.add_element("name", name) |
|
5047 | ||
5048 | if term: |
|
5049 | cmd.add_element("term", term) |
|
5050 | ||
5051 | if filter_type: |
|
5052 | if not isinstance(filter_type, self.types.FilterType): |
|
5053 | raise InvalidArgumentType( |
|
5054 | function=self.modify_filter.__name__, |
|
5055 | argument='filter_type', |
|
5056 | arg_type=self.types.FilterType.__name__, |
|
5057 | ) |
|
5058 | cmd.add_element("type", filter_type.value) |
|
5059 | ||
5060 | return self._send_xml_command(cmd) |
|
5061 | ||
5062 | def modify_group( |
|
5063 | self, |
@@ 3097-3144 (lines=48) @@ | ||
3094 | ||
3095 | return self._send_xml_command(cmd) |
|
3096 | ||
3097 | def modify_filter( |
|
3098 | self, |
|
3099 | filter_id: str, |
|
3100 | *, |
|
3101 | comment: Optional[str] = None, |
|
3102 | name: Optional[str] = None, |
|
3103 | term: Optional[str] = None, |
|
3104 | filter_type: Optional[FilterType] = None, |
|
3105 | ) -> Any: |
|
3106 | """Modifies an existing filter. |
|
3107 | ||
3108 | Arguments: |
|
3109 | filter_id: UUID of the filter to be modified |
|
3110 | comment: Comment on filter. |
|
3111 | name: Name of filter. |
|
3112 | term: Filter term. |
|
3113 | filter_type: Resource type filter applies to. |
|
3114 | ||
3115 | Returns: |
|
3116 | The response. See :py:meth:`send_command` for details. |
|
3117 | """ |
|
3118 | if not filter_id: |
|
3119 | raise RequiredArgument( |
|
3120 | function=self.modify_filter.__name__, argument='filter_id' |
|
3121 | ) |
|
3122 | ||
3123 | cmd = XmlCommand("modify_filter") |
|
3124 | cmd.set_attribute("filter_id", filter_id) |
|
3125 | ||
3126 | if comment: |
|
3127 | cmd.add_element("comment", comment) |
|
3128 | ||
3129 | if name: |
|
3130 | cmd.add_element("name", name) |
|
3131 | ||
3132 | if term: |
|
3133 | cmd.add_element("term", term) |
|
3134 | ||
3135 | if filter_type: |
|
3136 | if not isinstance(filter_type, self.types.FilterType): |
|
3137 | raise InvalidArgumentType( |
|
3138 | function=self.modify_filter.__name__, |
|
3139 | argument='filter_type', |
|
3140 | arg_type=FilterType.__name__, |
|
3141 | ) |
|
3142 | cmd.add_element("type", filter_type.value) |
|
3143 | ||
3144 | return self._send_xml_command(cmd) |
|
3145 | ||
3146 | def create_schedule( |
|
3147 | self, |
@@ 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, |