Package cm_api :: Package endpoints :: Module types :: Class BaseApiResource
[hide private]
[frames] | no frames]

Class BaseApiResource

source code

   object --+    
            |    
BaseApiObject --+
                |
               BaseApiResource
Known Subclasses:

A specialization of BaseApiObject that provides some utility methods for resources. This class allows easier serialization / deserialization of parameters and return values.

Instance Methods [hide private]
 
_api_version(self)
Returns the minimum API version for this resource.
source code
 
_path(self)
Returns the path to the resource.
source code
 
_require_min_api_version(self, version)
Raise an exception if the version of the api is less than the given version.
source code
 
_cmd(self, command, data=None, params=None, api_version=1)
Invokes a command on the resource.
source code
 
_get_config(self, rel_path, view, api_version=1)
Retrieves an ApiConfig list from the given relative path.
source code
 
_update_config(self, rel_path, config, api_version=1) source code
 
_delete(self, rel_path, ret_type, ret_is_list=False, params=None, api_version=1) source code
 
_get(self, rel_path, ret_type, ret_is_list=False, params=None, api_version=1) source code
 
_post(self, rel_path, ret_type, ret_is_list=False, data=None, params=None, api_version=1) source code
 
_put(self, rel_path, ret_type, ret_is_list=False, data=None, params=None, api_version=1) source code
 
_call(self, method, rel_path, ret_type, ret_is_list=False, data=None, params=None, api_version=1) source code

Inherited from BaseApiObject: __init__, __setattr__, __str__, to_json_dict

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from BaseApiObject: from_json_dict

Inherited from BaseApiObject (private): _get_attributes

Static Methods [hide private]

Inherited from BaseApiObject: init

Class Variables [hide private]

Inherited from BaseApiObject (private): _ATTRIBUTES, _WHITELIST

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_api_version(self)

source code 

Returns the minimum API version for this resource. Defaults to 1.

_path(self)

source code 

Returns the path to the resource.

e.g., for a service 'foo' in cluster 'bar', this should return '/clusters/bar/services/foo'.

_require_min_api_version(self, version)

source code 

Raise an exception if the version of the api is less than the given version.

Parameters:
  • version - The minimum required version.

_cmd(self, command, data=None, params=None, api_version=1)

source code 

Invokes a command on the resource. Commands are expected to be under the "commands/" sub-resource.