diff options
author | Dan Smith <dansmith@redhat.com> | 2016-07-28 11:12:50 -0700 |
---|---|---|
committer | Dan Smith <dansmith@redhat.com> | 2016-08-19 09:41:03 -0700 |
commit | aaebeb05a03e34281a091dc6dfc4672b01cdfbbb (patch) | |
tree | 9edb3f6628696359188f7314ef215ee2010e168d | |
parent | 578c39865d41158de185b90ca4cecc7fbb8f59ae (diff) | |
download | python-novaclient-aaebeb05a03e34281a091dc6dfc4672b01cdfbbb.tar.gz |
Deprecate all the nova-network functions in the python API
Per the plan, this marks all nova-network-related functions as
deprecated for removal.
Change-Id: I511793cd9a01669e77e1ae5ecb391ce937477309
-rw-r--r-- | novaclient/api_versions.py | 19 | ||||
-rw-r--r-- | novaclient/tests/unit/test_api_versions.py | 17 | ||||
-rw-r--r-- | novaclient/v2/contrib/tenant_networks.py | 13 | ||||
-rw-r--r-- | novaclient/v2/fixed_ips.py | 12 | ||||
-rw-r--r-- | novaclient/v2/floating_ip_dns.py | 52 | ||||
-rw-r--r-- | novaclient/v2/floating_ip_pools.py | 7 | ||||
-rw-r--r-- | novaclient/v2/floating_ips.py | 18 | ||||
-rw-r--r-- | novaclient/v2/floating_ips_bulk.py | 14 | ||||
-rw-r--r-- | novaclient/v2/fping.py | 11 | ||||
-rw-r--r-- | novaclient/v2/networks.py | 32 | ||||
-rw-r--r-- | novaclient/v2/security_group_default_rules.py | 15 | ||||
-rw-r--r-- | novaclient/v2/security_group_rules.py | 14 | ||||
-rw-r--r-- | novaclient/v2/security_groups.py | 24 |
13 files changed, 188 insertions, 60 deletions
diff --git a/novaclient/api_versions.py b/novaclient/api_versions.py index 0161b589..4abea01a 100644 --- a/novaclient/api_versions.py +++ b/novaclient/api_versions.py @@ -17,6 +17,7 @@ import os import pkgutil import re import traceback +import warnings from oslo_utils import strutils @@ -421,3 +422,21 @@ def _warn_missing_microversion_header(header_name): "Your request was processed by a Nova API which does not support " "microversions (%s header is missing from response). " "Warning: Response may be incorrect."), header_name) + + +def deprecated_after(version): + decorator = wraps('2.0', version) + + def wrapper(fn): + @functools.wraps(fn) + def wrapped(*a, **k): + decorated = decorator(fn) + if hasattr(fn, '__module__'): + mod = fn.__module__ + else: + mod = a[0].__module__ + warnings.warn('The %s module is deprecated ' + 'and will be removed.' % mod, DeprecationWarning) + return decorated(*a, **k) + return wrapped + return wrapper diff --git a/novaclient/tests/unit/test_api_versions.py b/novaclient/tests/unit/test_api_versions.py index 44ac2791..00eb2b6f 100644 --- a/novaclient/tests/unit/test_api_versions.py +++ b/novaclient/tests/unit/test_api_versions.py @@ -438,3 +438,20 @@ class DiscoverVersionTestCase(utils.TestCase): api_versions.discover_version( fake_client, api_versions.APIVersion('2.latest')).get_string()) + + +class DecoratedAfterTestCase(utils.TestCase): + def test_decorated_after(self): + + class Fake(object): + api_version = api_versions.APIVersion('2.123') + + @api_versions.deprecated_after('2.123') + def foo(self): + pass + + with mock.patch('warnings.warn') as mock_warn: + Fake().foo() + msg = ('The novaclient.tests.unit.test_api_versions module ' + 'is deprecated and will be removed.') + mock_warn.assert_called_once_with(msg, mock.ANY) diff --git a/novaclient/v2/contrib/tenant_networks.py b/novaclient/v2/contrib/tenant_networks.py index c088f777..16d69f38 100644 --- a/novaclient/v2/contrib/tenant_networks.py +++ b/novaclient/v2/contrib/tenant_networks.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from novaclient import api_versions from novaclient import base from novaclient.i18n import _ from novaclient import utils @@ -21,7 +22,7 @@ from novaclient.v2 import shell class TenantNetwork(base.Resource): def delete(self): """ - Delete this project network. + DEPRECATED: Delete this project network. :returns: An instance of novaclient.base.TupleWithMeta """ @@ -29,25 +30,33 @@ class TenantNetwork(base.Resource): class TenantNetworkManager(base.ManagerWithFind): + """DEPRECATED""" resource_class = base.Resource + @api_versions.deprecated_after('2.35') def list(self): + """DEPRECATED""" return self._list('/os-tenant-networks', 'networks') + @api_versions.deprecated_after('2.35') def get(self, network): + """DEPRECATED""" return self._get('/os-tenant-networks/%s' % base.getid(network), 'network') + @api_versions.deprecated_after('2.35') def delete(self, network): """ - Delete a specified project network. + DEPRECATED: Delete a specified project network. :param network: a project network to delete :returns: An instance of novaclient.base.TupleWithMeta """ return self._delete('/os-tenant-networks/%s' % base.getid(network)) + @api_versions.deprecated_after('2.35') def create(self, label, cidr): + """DEPRECATED""" body = {'network': {'label': label, 'cidr': cidr}} return self._create('/os-tenant-networks', body, 'network') diff --git a/novaclient/v2/fixed_ips.py b/novaclient/v2/fixed_ips.py index 232ac6fd..16604690 100644 --- a/novaclient/v2/fixed_ips.py +++ b/novaclient/v2/fixed_ips.py @@ -17,27 +17,32 @@ Fixed IPs interface. """ +from novaclient import api_versions from novaclient import base class FixedIP(base.Resource): + """DEPRECATED""" def __repr__(self): return "<FixedIP: %s>" % self.address class FixedIPsManager(base.Manager): + """DEPRECATED""" resource_class = FixedIP + @api_versions.deprecated_after('2.35') def get(self, fixed_ip): - """Show information for a Fixed IP. + """DEPRECATED: Show information for a Fixed IP. :param fixed_ip: Fixed IP address to get info for """ return self._get('/os-fixed-ips/%s' % base.getid(fixed_ip), "fixed_ip") + @api_versions.deprecated_after('2.35') def reserve(self, fixed_ip): - """Reserve a Fixed IP. + """DEPRECATED: Reserve a Fixed IP. :param fixed_ip: Fixed IP address to reserve :returns: An instance of novaclient.base.TupleWithMeta @@ -47,8 +52,9 @@ class FixedIPsManager(base.Manager): base.getid(fixed_ip), body=body) return self.convert_into_with_meta(body, resp) + @api_versions.deprecated_after('2.35') def unreserve(self, fixed_ip): - """Unreserve a Fixed IP. + """DEPRECATED: Unreserve a Fixed IP. :param fixed_ip: Fixed IP address to unreserve :returns: An instance of novaclient.base.TupleWithMeta diff --git a/novaclient/v2/floating_ip_dns.py b/novaclient/v2/floating_ip_dns.py index d6ccb8d5..64b3a65d 100644 --- a/novaclient/v2/floating_ip_dns.py +++ b/novaclient/v2/floating_ip_dns.py @@ -15,6 +15,7 @@ from six.moves.urllib import parse +from novaclient import api_versions from novaclient import base @@ -29,9 +30,11 @@ def _quote_domain(domain): class FloatingIPDNSDomain(base.Resource): + """DEPRECATED""" + def delete(self): """ - Delete the own Floating IP DNS domain. + DEPRECATED: Delete the own Floating IP DNS domain. :returns: An instance of novaclient.base.TupleWithMeta """ @@ -39,7 +42,7 @@ class FloatingIPDNSDomain(base.Resource): def create(self): """ - Create a Floating IP DNS domain. + DEPRECATED: Create a Floating IP DNS domain. :returns: An instance of novaclient.base.DictWithMeta """ @@ -51,7 +54,7 @@ class FloatingIPDNSDomain(base.Resource): def get(self): """ - Get the own Floating IP DNS domain. + DEPRECATED: Get the own Floating IP DNS domain. :returns: An instance of novaclient.base.TupleWithMeta or novaclient.base.ListWithMeta @@ -65,30 +68,36 @@ class FloatingIPDNSDomain(base.Resource): class FloatingIPDNSDomainManager(base.Manager): + """DEPRECATED""" + resource_class = FloatingIPDNSDomain + @api_versions.deprecated_after('2.35') def domains(self): - """Return the list of available dns domains.""" + """DEPRECATED: Return the list of available dns domains.""" return self._list("/os-floating-ip-dns", "domain_entries") + @api_versions.deprecated_after('2.35') def create_private(self, fqdomain, availability_zone): - """Add or modify a private DNS domain.""" + """DEPRECATED: Add or modify a private DNS domain.""" body = {'domain_entry': {'scope': 'private', 'availability_zone': availability_zone}} return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain), body, 'domain_entry') + @api_versions.deprecated_after('2.35') def create_public(self, fqdomain, project): - """Add or modify a public DNS domain.""" + """DEPRECATED: Add or modify a public DNS domain.""" body = {'domain_entry': {'scope': 'public', 'project': project}} return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain), body, 'domain_entry') + @api_versions.deprecated_after('2.35') def delete(self, fqdomain): """ - Delete the specified domain. + DEPRECATED: Delete the specified domain. :param fqdomain: The domain to delete :returns: An instance of novaclient.base.TupleWithMeta @@ -97,9 +106,11 @@ class FloatingIPDNSDomainManager(base.Manager): class FloatingIPDNSEntry(base.Resource): + """DEPRECATED""" + def delete(self): """ - Delete the own Floating IP DNS entry. + DEPRECATED: Delete the own Floating IP DNS entry. :returns: An instance of novaclient.base.TupleWithMeta """ @@ -107,7 +118,7 @@ class FloatingIPDNSEntry(base.Resource): def create(self): """ - Create a Floating IP DNS entry. + DEPRECATED: Create a Floating IP DNS entry. :returns: :class:`FloatingIPDNSEntry` """ @@ -115,42 +126,55 @@ class FloatingIPDNSEntry(base.Resource): self.dns_type) def get(self): + """DEPRECATED""" return self.manager.get(self.domain, self.name) class FloatingIPDNSEntryManager(base.Manager): + """DEPRECATED""" resource_class = FloatingIPDNSEntry + @api_versions.deprecated_after('2.35') def get(self, domain, name): - """Return a list of entries for the given domain and IP or name.""" + """ + DEPRECATED: Return a list of entries for the given domain and IP or + name. + """ return self._get("/os-floating-ip-dns/%s/entries/%s" % (_quote_domain(domain), name), "dns_entry") + @api_versions.deprecated_after('2.35') def get_for_ip(self, domain, ip): - """Return a list of entries for the given domain and IP or name.""" + """ + DEPRECATED: Return a list of entries for the given domain and IP or + name. + """ qparams = {'ip': ip} params = "?%s" % parse.urlencode(qparams) return self._list("/os-floating-ip-dns/%s/entries%s" % (_quote_domain(domain), params), "dns_entries") + @api_versions.deprecated_after('2.35') def create(self, domain, name, ip, dns_type): - """Add a new DNS entry.""" + """DEPRECATED: Add a new DNS entry.""" body = {'dns_entry': {'ip': ip, 'dns_type': dns_type}} return self._update("/os-floating-ip-dns/%s/entries/%s" % (_quote_domain(domain), name), body, "dns_entry") + @api_versions.deprecated_after('2.35') def modify_ip(self, domain, name, ip): - """Add a new DNS entry.""" + """DEPRECATED: Add a new DNS entry.""" body = {'dns_entry': {'ip': ip, 'dns_type': 'A'}} return self._update("/os-floating-ip-dns/%s/entries/%s" % (_quote_domain(domain), name), body, "dns_entry") + @api_versions.deprecated_after('2.35') def delete(self, domain, name): """ - Delete entry specified by name and domain. + DEPRECATED: Delete entry specified by name and domain. :returns: An instance of novaclient.base.TupleWithMeta """ diff --git a/novaclient/v2/floating_ip_pools.py b/novaclient/v2/floating_ip_pools.py index 9ea94a27..70a43ce2 100644 --- a/novaclient/v2/floating_ip_pools.py +++ b/novaclient/v2/floating_ip_pools.py @@ -14,17 +14,22 @@ # License for the specific language governing permissions and limitations # under the License. +from novaclient import api_versions from novaclient import base class FloatingIPPool(base.Resource): + """DEPRECATED""" + def __repr__(self): return "<FloatingIPPool: name=%s>" % self.name class FloatingIPPoolManager(base.ManagerWithFind): + """DEPRECATED""" resource_class = FloatingIPPool + @api_versions.deprecated_after('2.35') def list(self): - """Retrieve a list of all floating ip pools.""" + """DEPRECATED: Retrieve a list of all floating ip pools.""" return self._list('/os-floating-ip-pools', 'floating_ip_pools') diff --git a/novaclient/v2/floating_ips.py b/novaclient/v2/floating_ips.py index b25bb33f..2aea6a3b 100644 --- a/novaclient/v2/floating_ips.py +++ b/novaclient/v2/floating_ips.py @@ -14,13 +14,16 @@ # License for the specific language governing permissions and limitations # under the License. +from novaclient import api_versions from novaclient import base class FloatingIP(base.Resource): + """DEPRECATED""" + def delete(self): """ - Delete this floating IP + DEPRECATED: Delete this floating IP :returns: An instance of novaclient.base.TupleWithMeta """ @@ -28,25 +31,30 @@ class FloatingIP(base.Resource): class FloatingIPManager(base.ManagerWithFind): + """DEPRECATED""" resource_class = FloatingIP + @api_versions.deprecated_after('2.35') def list(self): - """List floating IPs""" + """DEPRECATED: List floating IPs""" return self._list("/os-floating-ips", "floating_ips") + @api_versions.deprecated_after('2.35') def create(self, pool=None): - """Create (allocate) a floating IP for a tenant""" + """DEPRECATED: Create (allocate) a floating IP for a tenant""" return self._create("/os-floating-ips", {'pool': pool}, "floating_ip") + @api_versions.deprecated_after('2.35') def delete(self, floating_ip): - """Delete (deallocate) a floating IP for a tenant + """DEPRECATED: Delete (deallocate) a floating IP for a tenant :param floating_ip: The floating IP address to delete. :returns: An instance of novaclient.base.TupleWithMeta """ return self._delete("/os-floating-ips/%s" % base.getid(floating_ip)) + @api_versions.deprecated_after('2.35') def get(self, floating_ip): - """Retrieve a floating IP""" + """DEPRECATED: Retrieve a floating IP""" return self._get("/os-floating-ips/%s" % base.getid(floating_ip), "floating_ip") diff --git a/novaclient/v2/floating_ips_bulk.py b/novaclient/v2/floating_ips_bulk.py index 4249af60..c0c8a8e1 100644 --- a/novaclient/v2/floating_ips_bulk.py +++ b/novaclient/v2/floating_ips_bulk.py @@ -16,20 +16,26 @@ """ Bulk Floating IPs interface """ +from novaclient import api_versions from novaclient import base from novaclient.v2 import floating_ips class FloatingIPRange(base.Resource): + """DEPRECATED""" + def __repr__(self): return "<FloatingIPRange: %s>" % self.ip_range class FloatingIPBulkManager(base.ManagerWithFind): + """DEPRECATED""" + resource_class = FloatingIPRange + @api_versions.deprecated_after('2.35') def list(self, host=None): - """List all floating IPs.""" + """DEPRECATED: List all floating IPs.""" if host is None: return self._list('/os-floating-ips-bulk', 'floating_ip_info', @@ -39,8 +45,9 @@ class FloatingIPBulkManager(base.ManagerWithFind): 'floating_ip_info', obj_class=floating_ips.FloatingIP) + @api_versions.deprecated_after('2.35') def create(self, ip_range, pool=None, interface=None): - """Create floating IPs by range.""" + """DEPRECATED: Create floating IPs by range.""" body = {"floating_ips_bulk_create": {'ip_range': ip_range}} if pool is not None: body['floating_ips_bulk_create']['pool'] = pool @@ -50,7 +57,8 @@ class FloatingIPBulkManager(base.ManagerWithFind): return self._create('/os-floating-ips-bulk', body, 'floating_ips_bulk_create') + @api_versions.deprecated_after('2.35') def delete(self, ip_range): - """Delete floating IPs by range.""" + """DEPRECATED: Delete floating IPs by range.""" body = {"ip_range": ip_range} return self._update('/os-floating-ips-bulk/delete', body) diff --git a/novaclient/v2/fping.py b/novaclient/v2/fping.py index ad2bfb99..cee13226 100644 --- a/novaclient/v2/fping.py +++ b/novaclient/v2/fping.py @@ -18,11 +18,12 @@ Fping interface. """ from six.moves import urllib +from novaclient import api_versions from novaclient import base class Fping(base.Resource): - """A server to fping.""" + """DEPRECATED: A server to fping.""" HUMAN_ID = True def __repr__(self): @@ -30,11 +31,12 @@ class Fping(base.Resource): class FpingManager(base.ManagerWithFind): - """Manage :class:`Fping` resources.""" + """DEPRECATED: Manage :class:`Fping` resources.""" resource_class = Fping + @api_versions.deprecated_after('2.35') def list(self, all_tenants=False, include=None, exclude=None): - """Fping all servers. + """DEPRECATED: Fping all servers. :returns: list of :class:`Fping`. """ @@ -52,8 +54,9 @@ class FpingManager(base.ManagerWithFind): uri = "%s?%s" % (uri, urllib.parse.urlencode(params)) return self._list(uri, "servers") + @api_versions.deprecated_after('2.35') def get(self, server): - """Fping a specific server. + """DEPRECATED: Fping a specific server. :param server: ID of the server to fping. :returns: :class:`Fping` diff --git a/novaclient/v2/networks.py b/novaclient/v2/networks.py index 4f545403..36a69423 100644 --- a/novaclient/v2/networks.py +++ b/novaclient/v2/networks.py @@ -16,7 +16,7 @@ """ Network interface. """ - +from novaclient import api_versions from novaclient import base from novaclient import exceptions from novaclient.i18n import _ @@ -34,7 +34,7 @@ class Network(base.Resource): def delete(self): """ - Delete this network. + DEPRECATED: Delete this network. :returns: An instance of novaclient.base.TupleWithMeta """ @@ -76,21 +76,23 @@ class NeutronManager(base.Manager): class NetworkManager(base.ManagerWithFind): """ - Manage :class:`Network` resources. + DEPRECATED: Manage :class:`Network` resources. """ resource_class = Network + @api_versions.deprecated_after('2.35') def list(self): """ - Get a list of all networks. + DEPRECATED: Get a list of all networks. :rtype: list of :class:`Network`. """ return self._list("/os-networks", "networks") + @api_versions.deprecated_after('2.35') def get(self, network): """ - Get a specific network. + DEPRECATED: Get a specific network. :param network: The ID of the :class:`Network` to get. :rtype: :class:`Network` @@ -98,18 +100,20 @@ class NetworkManager(base.ManagerWithFind): return self._get("/os-networks/%s" % base.getid(network), "network") + @api_versions.deprecated_after('2.35') def delete(self, network): """ - Delete a specific network. + DEPRECATED: Delete a specific network. :param network: The ID of the :class:`Network` to delete. :returns: An instance of novaclient.base.TupleWithMeta """ return self._delete("/os-networks/%s" % base.getid(network)) + @api_versions.deprecated_after('2.35') def create(self, **kwargs): """ - Create (allocate) a network. The following parameters are + DEPRECATED: Create (allocate) a network. The following parameters are optional except for label; cidr or cidr_v6 must be specified, too. :param label: str @@ -140,10 +144,11 @@ class NetworkManager(base.ManagerWithFind): body = {"network": kwargs} return self._create('/os-networks', body, 'network') + @api_versions.deprecated_after('2.35') def disassociate(self, network, disassociate_host=True, disassociate_project=True): """ - Disassociate a specific network from project and/or host. + DEPRECATED: Disassociate a specific network from project and/or host. :param network: The ID of the :class:`Network`. :param disassociate_host: Whether to disassociate the host @@ -165,9 +170,10 @@ class NetworkManager(base.ManagerWithFind): return self.convert_into_with_meta(body, resp) + @api_versions.deprecated_after('2.35') def associate_host(self, network, host): """ - Associate a specific network with a host. + DEPRECATED: Associate a specific network with a host. :param network: The ID of the :class:`Network`. :param host: The name of the host to associate the network with @@ -179,9 +185,10 @@ class NetworkManager(base.ManagerWithFind): return self.convert_into_with_meta(body, resp) + @api_versions.deprecated_after('2.35') def associate_project(self, network): """ - Associate a specific network with a project. + DEPRECATED: Associate a specific network with a project. The project is defined by the project authenticated against @@ -193,10 +200,11 @@ class NetworkManager(base.ManagerWithFind): return self.convert_into_with_meta(body, resp) + @api_versions.deprecated_after('2.35') def add(self, network=None): """ - Associates the current project with a network. Network can be chosen - automatically or provided explicitly. + DEPRECATED: Associates the current project with a network. Network can + be chosen automatically or provided explicitly. :param network: The ID of the :class:`Network` to associate (optional). :returns: An instance of novaclient.base.TupleWithMeta diff --git a/novaclient/v2/security_group_default_rules.py b/novaclient/v2/security_group_default_rules.py index 6516a460..58aef144 100644 --- a/novaclient/v2/security_group_default_rules.py +++ b/novaclient/v2/security_group_default_rules.py @@ -13,19 +13,20 @@ """ Security group default rules interface. """ - +from novaclient import api_versions from novaclient import base from novaclient import exceptions from novaclient.i18n import _ class SecurityGroupDefaultRule(base.Resource): + """DEPRECATED""" def __str__(self): return str(self.id) def delete(self): """ - Delete this security group default rule. + DEPRECATED: Delete this security group default rule. :returns: An instance of novaclient.base.TupleWithMeta """ @@ -33,12 +34,14 @@ class SecurityGroupDefaultRule(base.Resource): class SecurityGroupDefaultRuleManager(base.Manager): + """DEPRECATED""" resource_class = SecurityGroupDefaultRule + @api_versions.deprecated_after('2.35') def create(self, ip_protocol=None, from_port=None, to_port=None, cidr=None): """ - Create a security group default rule + DEPRECATED: Create a security group default rule :param ip_protocol: IP protocol, one of 'tcp', 'udp' or 'icmp' :param from_port: Source port @@ -67,9 +70,10 @@ class SecurityGroupDefaultRuleManager(base.Manager): return self._create('/os-security-group-default-rules', body, 'security_group_default_rule') + @api_versions.deprecated_after('2.35') def delete(self, rule): """ - Delete a security group default rule + DEPRECATED: Delete a security group default rule :param rule: The security group default rule to delete (ID or Class) :returns: An instance of novaclient.base.TupleWithMeta @@ -77,9 +81,10 @@ class SecurityGroupDefaultRuleManager(base.Manager): return self._delete('/os-security-group-default-rules/%s' % base.getid(rule)) + @api_versions.deprecated_after('2.35') def list(self): """ - Get a list of all security group default rules + DEPRECATED: Get a list of all security group default rules :rtype: list of :class:`SecurityGroupDefaultRule` """ diff --git a/novaclient/v2/security_group_rules.py b/novaclient/v2/security_group_rules.py index c1060372..750fba41 100644 --- a/novaclient/v2/security_group_rules.py +++ b/novaclient/v2/security_group_rules.py @@ -16,19 +16,21 @@ """ Security group rules interface (1.1 extension). """ - +from novaclient import api_versions from novaclient import base from novaclient import exceptions from novaclient.i18n import _ class SecurityGroupRule(base.Resource): + """DEPRECATED""" + def __str__(self): return str(self.id) def delete(self): """ - Delete this security group rule. + DEPRECATED: Delete this security group rule. :returns: An instance of novaclient.base.TupleWithMeta """ @@ -36,12 +38,15 @@ class SecurityGroupRule(base.Resource): class SecurityGroupRuleManager(base.Manager): + """DEPRECATED""" + resource_class = SecurityGroupRule + @api_versions.deprecated_after('2.35') def create(self, parent_group_id, ip_protocol=None, from_port=None, to_port=None, cidr=None, group_id=None): """ - Create a security group rule + DEPRECATED: Create a security group rule :param ip_protocol: IP protocol, one of 'tcp', 'udp' or 'icmp' :param from_port: Source port @@ -74,9 +79,10 @@ class SecurityGroupRuleManager(base.Manager): return self._create('/os-security-group-rules', body, 'security_group_rule') + @api_versions.deprecated_after('2.35') def delete(self, rule): """ - Delete a security group rule + DEPRECATED: Delete a security group rule :param rule: The security group rule to delete (ID or Class) :returns: An instance of novaclient.base.TupleWithMeta diff --git a/novaclient/v2/security_groups.py b/novaclient/v2/security_groups.py index a6bf6379..88198ec7 100644 --- a/novaclient/v2/security_groups.py +++ b/novaclient/v2/security_groups.py @@ -20,16 +20,19 @@ Security group interface (1.1 extension). import six from six.moves.urllib import parse +from novaclient import api_versions from novaclient import base class SecurityGroup(base.Resource): + """DEPRECATED""" + def __str__(self): return str(self.id) def delete(self): """ - Delete this security group. + DEPRECATED: Delete this security group. :returns: An instance of novaclient.base.TupleWithMeta """ @@ -37,7 +40,7 @@ class SecurityGroup(base.Resource): def update(self): """ - Update this security group. + DEPRECATED: Update this security group. :returns: :class:`SecurityGroup` """ @@ -45,11 +48,14 @@ class SecurityGroup(base.Resource): class SecurityGroupManager(base.ManagerWithFind): + """DEPRECATED""" + resource_class = SecurityGroup + @api_versions.deprecated_after('2.35') def create(self, name, description): """ - Create a security group + DEPRECATED: Create a security group :param name: name for the security group to create :param description: description of the security group @@ -58,9 +64,10 @@ class SecurityGroupManager(base.ManagerWithFind): body = {"security_group": {"name": name, 'description': description}} return self._create('/os-security-groups', body, 'security_group') + @api_versions.deprecated_after('2.35') def update(self, group, name, description): """ - Update a security group + DEPRECATED: Update a security group :param group: The security group to update (group or ID) :param name: name for the security group to update @@ -71,18 +78,20 @@ class SecurityGroupManager(base.ManagerWithFind): return self._update('/os-security-groups/%s' % base.getid(group), body, 'security_group') + @api_versions.deprecated_after('2.35') def delete(self, group): """ - Delete a security group + DEPRECATED: Delete a security group :param group: The security group to delete (group or ID) :returns: An instance of novaclient.base.TupleWithMeta """ return self._delete('/os-security-groups/%s' % base.getid(group)) + @api_versions.deprecated_after('2.35') def get(self, group_id): """ - Get a security group + DEPRECATED: Get a security group :param group_id: The security group to get by ID :rtype: :class:`SecurityGroup` @@ -90,9 +99,10 @@ class SecurityGroupManager(base.ManagerWithFind): return self._get('/os-security-groups/%s' % group_id, 'security_group') + @api_versions.deprecated_after('2.35') def list(self, search_opts=None): """ - Get a list of all security_groups + DEPRECATED: Get a list of all security_groups :rtype: list of :class:`SecurityGroup` """ |