@@ -470,15 +470,45 @@ def list_global_ips(self, version=None, identifier=None, **kwargs):
470470 kwargs ['filter' ] = _filter .to_dict ()
471471 return self .account .getGlobalIpRecords (** kwargs )
472472
473- def list_subnets (self , ** kwargs ):
473+ def list_subnets (self , identifier = None , datacenter = None , version = 0 ,
474+ subnet_type = None , network_space = None , ** kwargs ):
474475 """Display a list of all subnets on the account.
475476
476477 This provides a quick overview of all subnets including information
477478 about data center residence and the number of devices attached.
479+
480+ :param string identifier: If specified, the list will only contain the
481+ subnet matching this network identifier.
482+ :param string datacenter: If specified, the list will only contain
483+ subnets in the specified data center.
484+ :param int version: Only returns subnets of this version (4 or 6).
485+ :param string subnet_type: If specified, it will only returns subnets
486+ of this type.
487+ :param string network_space: If specified, it will only returns subnets
488+ with the given address space label.
489+ :param dict \\ *\\ *kwargs: response-level options (mask, limit, etc.)
478490 """
479491 if 'mask' not in kwargs :
480492 kwargs ['mask' ] = DEFAULT_SUBNET_MASK
481493
494+ _filter = utils .NestedDict (kwargs .get ('filter' ) or {})
495+
496+ if identifier :
497+ _filter ['subnets' ]['networkIdentifier' ] = (
498+ utils .query_filter (identifier ))
499+ if datacenter :
500+ _filter ['subnets' ]['datacenter' ]['name' ] = (
501+ utils .query_filter (datacenter ))
502+ if version :
503+ _filter ['subnets' ]['version' ] = utils .query_filter (version )
504+ if subnet_type :
505+ _filter ['subnets' ]['subnetType' ] = utils .query_filter (subnet_type )
506+
507+ if network_space :
508+ _filter ['subnets' ]['networkVlan' ]['networkSpace' ] = (
509+ utils .query_filter (network_space ))
510+
511+ kwargs ['filter' ] = _filter .to_dict ()
482512 kwargs ['iter' ] = True
483513 return self .client .call ('Account' , 'getSubnets' , ** kwargs )
484514
0 commit comments