Package cm_api :: Package endpoints :: Module clusters :: Class ApiCluster
[hide private]
[frames] | no frames]

Class ApiCluster

source code

         object --+    
                  |    
types.BaseApiObject --+
                      |
                     ApiCluster

Instance Methods [hide private]
 
__init__(self, resource_root, name=None, version=None)
Initializes internal state and sets all known writable properties of the object to None.
source code
 
__str__(self)
Default implementation of __str__.
source code
 
_path(self) source code
 
_cmd(self, cmd, data=None) source code
 
_put(self, dic, params=None)
Change cluster attributes
source code
 
get_commands(self, view=None)
Retrieve a list of running commands for this cluster.
source code
 
rename(self, newname)
Rename a cluster.
source code
 
create_service(self, name, service_type)
Create a service.
source code
 
delete_service(self, name)
Delete a service by name.
source code
 
get_service(self, name)
Lookup a service by name.
source code
 
get_all_services(self, view=None)
Get all services in this cluster.
source code
 
get_parcel(self, product, version)
Lookup a parcel by product and version.
source code
 
get_all_parcels(self, view=None)
Get all parcels in this cluster.
source code
 
list_hosts(self)
Lists all the hosts that are associated with this cluster.
source code
 
remove_host(self, hostId)
Removes the association of the host with the cluster.
source code
 
remove_all_hosts(self)
Removes the association of all the hosts with the cluster.
source code
 
add_hosts(self, hostIds)
Adds a host to the cluster.
source code
 
start(self)
Start all services in a cluster, respecting dependencies.
source code
 
stop(self)
Stop all services in a cluster, respecting dependencies.
source code
 
deploy_client_config(self)
Deploys client configuration to the hosts on the cluster.
source code
 
enter_maintenance_mode(self)
Put the cluster in maintenance mode.
source code
 
exit_maintenance_mode(self)
Take the cluster out of maintenance mode.
source code
 
get_all_host_templates(self)
Retrieves all host templates in the cluster.
source code
 
get_host_template(self, name)
Retrieves a host templates by name.
source code
 
create_host_template(self, name)
Creates a host template.
source code
 
delete_host_template(self, name)
Deletes a host template.
source code
 
rolling_restart(self, slave_batch_size=None, slave_fail_count_threshold=None, sleep_seconds=None, stale_configs_only=None, unupgraded_only=None, roles_to_include=None, restart_service_names=None)
Command to do a "best-effort" rolling restart of the given cluster, i.e.
source code

Inherited from types.BaseApiObject: __setattr__, to_json_dict

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

Class Methods [hide private]

Inherited from types.BaseApiObject: from_json_dict

Inherited from types.BaseApiObject (private): _get_attributes

Static Methods [hide private]

Inherited from types.BaseApiObject: init

Class Variables [hide private]
  _ATTRIBUTES = {'name': None, 'version': None, 'maintenanceMode...

Inherited from types.BaseApiObject (private): _WHITELIST

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, resource_root, name=None, version=None)
(Constructor)

source code 

Initializes internal state and sets all known writable properties of the object to None. Then initializes the properties given in the provided attributes dictionary.

Parameters:
  • resource_root - API resource object.
  • attrs - optional dictionary of attributes to set. This should only contain r/w attributes.
Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

Default implementation of __str__. Uses the type name and the first attribute retrieved from the attribute map to create the string.

Overrides: object.__str__
(inherited documentation)

get_commands(self, view=None)

source code 

Retrieve a list of running commands for this cluster.

Parameters:
  • view - View to materialize ('full' or 'summary')
Returns:
A list of running commands.

rename(self, newname)

source code 

Rename a cluster.

Parameters:
  • newname - New cluster name
Returns:
An ApiCluster object

Since: API v2

create_service(self, name, service_type)

source code 

Create a service.

Parameters:
  • name - Service name
  • service_type - Service type
Returns:
An ApiService object

delete_service(self, name)

source code 

Delete a service by name.

@param name Service name @return The deleted ApiService object

get_service(self, name)

source code 

Lookup a service by name.

Parameters:
  • name - Service name
Returns:
An ApiService object

get_all_services(self, view=None)

source code 

Get all services in this cluster.

Returns:
A list of ApiService objects.

get_parcel(self, product, version)

source code 

Lookup a parcel by product and version.

Parameters:
  • product - the product name
  • version - the product version
Returns:
An ApiParcel object

get_all_parcels(self, view=None)

source code 

Get all parcels in this cluster.

Returns:
A list of ApiParcel objects.

list_hosts(self)

source code 

Lists all the hosts that are associated with this cluster.

Returns:
A list of ApiHostRef objects of the hosts in the cluster.

remove_host(self, hostId)

source code 

Removes the association of the host with the cluster.

Returns:
A ApiHostRef of the host that was removed.

remove_all_hosts(self)

source code 

Removes the association of all the hosts with the cluster.

Returns:
A list of ApiHostRef objects of the hosts that were removed.

add_hosts(self, hostIds)

source code 

Adds a host to the cluster.

Parameters:
  • hostIds - List of IDs of hosts to add to cluster.
Returns:
A list of ApiHostRef objects of the new hosts that were added to the cluster

start(self)

source code 

Start all services in a cluster, respecting dependencies.

Returns:
Reference to the submitted command.

stop(self)

source code 

Stop all services in a cluster, respecting dependencies.

Returns:
Reference to the submitted command.

deploy_client_config(self)

source code 

Deploys client configuration to the hosts on the cluster.

Returns:
Reference to the submitted command.

Since: API v2

enter_maintenance_mode(self)

source code 

Put the cluster in maintenance mode.

Returns:
Reference to the completed command.

Since: API v2

exit_maintenance_mode(self)

source code 

Take the cluster out of maintenance mode.

Returns:
Reference to the completed command.

Since: API v2

get_all_host_templates(self)

source code 

Retrieves all host templates in the cluster. @return ApiList of ApiHostTemplate objects.

get_host_template(self, name)

source code 

Retrieves a host templates by name.

Parameters:
  • name - Host template name. @return An ApiHostTemplate object.

create_host_template(self, name)

source code 

Creates a host template.

Parameters:
  • name - Name of the host template to create. @return An ApiHostTemplate object.

delete_host_template(self, name)

source code 

Deletes a host template.

Parameters:
  • name - Name of the host template to delete. @return An ApiHostTemplate object.

rolling_restart(self, slave_batch_size=None, slave_fail_count_threshold=None, sleep_seconds=None, stale_configs_only=None, unupgraded_only=None, roles_to_include=None, restart_service_names=None)

source code 

Command to do a "best-effort" rolling restart of the given cluster, i.e. it does plain restart of services that cannot be rolling restarted, followed by first rolling restarting non-slaves and then rolling restarting the slave roles of services that can be rolling restarted. The slave restarts are done host-by-host.

Returns:
Reference to the submitted command.

Since: API v4


Class Variable Details [hide private]

_ATTRIBUTES

Value:
{'name': None, 'version': None, 'maintenanceMode': ROAttr(), 'maintena\
nceOwners': ROAttr(),}