Server

class cloudpassage.Server(session)

Initializing the Server class:

Parameters:session (cloudpassage.HaloSession) – This will define how you interact with the Halo API, including proxy settings and API keys used for authentication.
assign_group(server_id, group_id)

Moves server to another group.

Parameters:
  • server_id (str) – Target server’s ID
  • group_id (str) – ID of group to move server to.
Returns:

True if successful, throws exceptions if it fails.

command_details(server_id, command_id)

This method retrieves the details and status of a server command.

Parameters:
  • server_id (str) – ID of server runnung command
  • command_id (str) – ID of command running on server
Returns:

Command status as a dictionary object.

Return type:

dict

Example:

{
  "name": "",
  "status: "",
  "created_at": "",
  "updated_at": "",
  "result": ""
 }

For server account creation and server account password resets, the password will be contained in the result field, as a dictionary:

{
  "name": "",
  "status: "",
  "created_at": "",
  "updated_at": "",
  "result": {
             "password": ""
             }
}
delete(server_id)

Deletes server indicated by server_id.

Remember, deletion causes the removal of accociated security events and scan information.

Parameters:server_id (str) – ID of server to be deleted
Returns:True if successful, throws exceptions otherwise.
describe(server_id)

Get server details by server ID

Parameters:server_id (str) – Server ID
Returns:Dictionary object describing server
Return type:dict
list_all(**kwargs)

Returns a list of all servers.

This query is limited to 50 pages of 10 items, totaling 500 servers.

Default filter returns only servers in the ‘active’ state.

Keyword Arguments:
 
  • state (list or str) – A list or comma-separated string containing any of these: active, missing, deactivated
  • platform (list or str) – A list or comma-separated string containing any of these: windows, debian, ubuntu, centos, oracle, rhel, etc...
  • cve (str) – CVE ID. Example: CVE-2015-1234
  • kb (str) – Search for presence of KB. Example: kb=”KB2485376”
  • missing_kb (str) – Search for absence of KB. Example: mising_kb=”KB2485376”
Returns:

List of dictionary objects describing servers

Return type:

list

retire(server_id)

This method retires a server

Parameters:server_id (str) – ID of server to be retired
Returns:True if successful, throws exception on failure