|
14 | 14 | from openstack.network.v2 import agent as _agent |
15 | 15 | from openstack.network.v2 import availability_zone |
16 | 16 | from openstack.network.v2 import extension |
| 17 | +from openstack.network.v2 import flavor as _flavor |
17 | 18 | from openstack.network.v2 import floating_ip as _floating_ip |
18 | 19 | from openstack.network.v2 import health_monitor as _health_monitor |
19 | 20 | from openstack.network.v2 import listener as _listener |
@@ -822,6 +823,86 @@ def update_network(self, network, **attrs): |
822 | 823 | """ |
823 | 824 | return self._update(_network.Network, network, **attrs) |
824 | 825 |
|
| 826 | + def create_flavor(self, **attrs): |
| 827 | + """Create a new network service flavor from attributes |
| 828 | +
|
| 829 | + :param dict attrs: Keyword arguments which will be used to create |
| 830 | + a :class:`~openstack.network.v2.flavor.Flavor`, |
| 831 | + comprised of the properties on the Flavor class. |
| 832 | +
|
| 833 | + :returns: The results of flavor creation |
| 834 | + :rtype: :class:`~openstack.network.v2.flavor.Flavor` |
| 835 | + """ |
| 836 | + return self._create(_flavor.Flavor, **attrs) |
| 837 | + |
| 838 | + def delete_flavor(self, flavor, ignore_missing=True): |
| 839 | + """Delete a network service flavor |
| 840 | +
|
| 841 | + :param flavor: |
| 842 | + The value can be either the ID of a flavor or a |
| 843 | + :class:`~openstack.network.v2.flavor.Flavor` instance. |
| 844 | + :param bool ignore_missing: When set to ``False`` |
| 845 | + :class:`~openstack.exceptions.ResourceNotFound` will be |
| 846 | + raised when the flavor does not exist. |
| 847 | + When set to ``True``, no exception will be set when |
| 848 | + attempting to delete a nonexistent flavor. |
| 849 | +
|
| 850 | + :returns: ``None`` |
| 851 | + """ |
| 852 | + self._delete(_flavor.Flavor, flavor, ignore_missing=ignore_missing) |
| 853 | + |
| 854 | + def find_flavor(self, name_or_id, ignore_missing=True): |
| 855 | + """Find a single network service flavor |
| 856 | +
|
| 857 | + :param name_or_id: The name or ID of a flavor. |
| 858 | + :param bool ignore_missing: When set to ``False`` |
| 859 | + :class:`~openstack.exceptions.ResourceNotFound` will be |
| 860 | + raised when the resource does not exist. |
| 861 | + When set to ``True``, None will be returned when |
| 862 | + attempting to find a nonexistent resource. |
| 863 | + :returns: One :class:`~openstack.network.v2.flavor.Flavor` or None |
| 864 | + """ |
| 865 | + return self._find(_flavor.Flavor, name_or_id, |
| 866 | + ignore_missing=ignore_missing) |
| 867 | + |
| 868 | + def get_flavor(self, flavor): |
| 869 | + """Get a single network service flavor |
| 870 | +
|
| 871 | + :param flavor: |
| 872 | + The value can be the ID of a flavor or a |
| 873 | + :class:`~openstack.network.v2.flavor.Flavor` instance. |
| 874 | +
|
| 875 | + :returns: One :class:`~openstack.network.v2.flavor.Flavor` |
| 876 | + :raises: :class:`~openstack.exceptions.ResourceNotFound` |
| 877 | + when no resource can be found. |
| 878 | + """ |
| 879 | + return self._get(_flavor.Flavor, flavor) |
| 880 | + |
| 881 | + def update_flavor(self, flavor, **attrs): |
| 882 | + """Update a network service flavor |
| 883 | +
|
| 884 | + :param flavor: |
| 885 | + Either the id of a flavor or a |
| 886 | + :class:`~openstack.network.v2.flavor.Flavor` instance. |
| 887 | + :attrs kwargs: The attributes to update on the flavor represented |
| 888 | + by ``value``. |
| 889 | +
|
| 890 | + :returns: The updated flavor |
| 891 | + :rtype: :class:`~openstack.network.v2.flavor.Flavor` |
| 892 | + """ |
| 893 | + return self._update(_flavor.Flavor, flavor, **attrs) |
| 894 | + |
| 895 | + def flavors(self, **query): |
| 896 | + """Return a generator of network service flavors |
| 897 | +
|
| 898 | + :param kwargs \*\*query: Optional query parameters to be sent to limit |
| 899 | + the resources being returned. |
| 900 | +
|
| 901 | + :returns: A generator of flavor objects |
| 902 | + :rtype: :class:`~openstack.network.v2.flavor.Flavor` |
| 903 | + """ |
| 904 | + return self._list(_flavor.Flavor, paginated=True, **query) |
| 905 | + |
825 | 906 | def find_network_ip_availability(self, name_or_id, ignore_missing=True): |
826 | 907 | """Find IP availability of a network |
827 | 908 |
|
|
0 commit comments