@@ -364,22 +364,6 @@ class ResourceBase(PathElement, ToDictMixin):
364364 that represents objects in a hierarchical relationship similar to the
365365 device's uri path hierarchy.
366366 """
367- def __init__ (self , container ):
368- """Call this with containing_object_instance.FOO
369-
370- Where FOO is a concrete subclass of this class, ResourceBase. The '.'
371- operator passes "FOO" to the __getattr__ method of the
372- containing_object_instance which instantiates it as the appropriate
373- sub-type of ResourceBase.
374-
375- Since all ResourceBases sub-types must support the `refresh` method, it
376- is defined here, in the base class.
377- NOTE: The BIG-IP® uri 'mgmt/tm/' uniquely passes itself to this
378- constructor as the "container".
379-
380- :param container: instance is an attribute of a ResourceBase container
381- """
382- super (ResourceBase , self ).__init__ (container )
383367
384368 def _modify (self , ** patch ):
385369 """Wrapped with modify, override in a subclass to customize."""
@@ -634,12 +618,6 @@ class OrganizingCollection(ResourceBase):
634618 * provide a list of dictionaries that contain uri's to other
635619 resources on the device.
636620 """
637- def __init__ (self , container ):
638- """Call this to construct an OC. It should be an attribute of BIG-IP®.
639-
640- :param bigip: all OCs are attributes of a BIG-IP® instance
641- """
642- super (OrganizingCollection , self ).__init__ (container )
643621
644622 def get_collection (self , ** kwargs ):
645623 """Call to obtain a list of the reference dicts in the instance `items`
@@ -665,20 +643,6 @@ class Collection(ResourceBase):
665643 unless it ends in ``s`` then it must have ``_s``.
666644
667645 """
668- def __init__ (self , container ):
669- """Call this with the __get_attr__ of a Resource or OC.
670-
671- The contained-by-an-OC-or-Resource pattern is observed, and not a
672- strictly enforced part of the model.
673-
674- URIs are constructed _from_ Collection subclass names. All Collection
675- subclass names MUST end in 's' or '_s', to distinguish them from their
676- associated Resource (which is always accessible as an attribute of the
677- subclass instance.
678-
679- :param container: instances of Collection are attributes of container
680- """
681- super (Collection , self ).__init__ (container )
682646
683647 def get_collection (self , ** kwargs ):
684648 """Get an iterator of Python ``Resource`` objects that represent URIs.
@@ -807,6 +771,7 @@ def _activate_URI(self, selfLinkuri):
807771 # attrs local alias
808772 attribute_reg = self ._meta_data .get ('attribute_registry' , {})
809773 attrs = attribute_reg .values ()
774+ attrs .append (Stats )
810775
811776 (scheme , domain , path , qarg , frag ) = urlparse .urlsplit (selfLinkuri )
812777 path_uri = urlparse .urlunsplit ((scheme , uri .netloc , path , '' , '' ))
@@ -1035,3 +1000,20 @@ def load(self, **kwargs):
10351000 newinst = self ._stamp_out_core ()
10361001 newinst ._refresh (** kwargs )
10371002 return newinst
1003+
1004+
1005+ class Stats (UnnamedResource ):
1006+ '''For stats resources.'''
1007+
1008+ def modify (self , ** kwargs ):
1009+ '''Modify is not supported for unnamed resources
1010+
1011+ :raises: UnsupportedOperation
1012+ '''
1013+ raise UnsupportedMethod (
1014+ "%s does not support the modify method" % self .__class__ .__name__
1015+ )
1016+
1017+ def load (self , ** kwargs ):
1018+ # TODO(pjbreaux) add try-except and custom exception here.
1019+ return super (Stats , self ).load (** kwargs )
0 commit comments