ServerGroup

class cloudpassage.ServerGroup(session)

Initializing the ServerGroup class:

Filters for ServerGroup queries can be found in the API documentation. See here: https://api-doc.cloudpassage.com/help#object-representation-1 for more information.

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

Creates a ServerGroup.

Parameters:

group_name (str) – Name for the new group

Keyword Arguments:
 
  • firewall_policy_id (str) – ID of firewall policy to be assigned to the group (deprecated- use linux_firewall_policy_id)
  • linux_firewall_policy_id (str) – ID of linux firewall policy to associate with the new group
  • windows_firewall_policy_id (str) – ID of Windows firewall policy to associate with the new group
  • policy_ids (list) – List of Linux configuration policy IDs
  • windows_policy_ids (list) – List of Windows configuration policy IDs
  • fim_policy_ids (list) – List of Linux FIM policies
  • linux_fim_policy_ids (list) – List of Linux FIM policies
  • windows_fim_policy_ids (list) – List of Windows FIM policies
  • lids_policy_ids (list) – List of LIDS policy IDs
  • tag (str) – Server group tag-used for auto-assignment of group.
  • server_events_policy (str) – Special events policy IDs
  • alert_profiles (list) – List of alert profile IDs
Returns:

ID of newly-created group.

Return type:

str

delete(group_id, **kwargs)

Delete a server group.

Parameters:group_id (str) – ID of group to delete
Keyword Arguments:
 force (bool) – If set to True, the member servers from this group will be moved to the parent group.
Returns:None if successful, exceptions otherwise.
describe(object_id)

Get the detailed configuration by ID

Parameters:object_id (str) – ID to retrieve detailed configuration information for
Returns:dictionary object representing the entire object.
Return type:dict
list_all(**kwargs)

Lists all objects of this type.

Returns:List of objects (represented as dictionary-type objects)
Return type:list

Note

This method supports query parameters via keyword arguments.

list_connections(group_id, **kwargs)

Return all recently detected connections in the server group.

Parameters:server_id (str) – Group ID
Returns:List of all recently detected connections in the server group
Return type:list
list_members(group_id)

Returns a list of all member servers of a group_id

Parameters:group_id (str) – ID of group_id
Returns:List of dictionary objects describing member servers
Return type:list
migrate_servers(grp_id, server_ids, srv_state=None)

Migrate servers in server_ids into the group identified by group_id.

Parameters:
  • grp_id (str) – ID of group to merge
  • server_ids (list) – A list of server_id
  • srv_state (str) – A comma-separated string containing filters to be applied to the list of servers to be migrated. Valid filters are active, missing, deactivated, and retired
Returns:

server ids – A list of all server_id in the identified server group.

Return type:

list

update(group_id, **kwargs)

Updates a ServerGroup.

Parameters:

group_id (str) – ID of group to be altered

Keyword Arguments:
 
  • name (str) – Override name for group
  • linux_firewall_policy_id (str) – Override Linux firewall policy ID.
  • windows_firewall_policy_id (str) – Override Windows firewall policy ID.
  • policy_ids (list) – Override Linux configuration policies
  • windows_policy_ids (list) – Override Windows firewall policies
  • linux_fim_policy_ids (list) – Override Linux firewall policies
  • windows_fim_policy_ids (list) – Override Windows FIM policies
  • lids_policy_ids (list) – Override LIDS policy IDs
  • tag (str) – Override server group tag
  • special_events_policy (str) – Override server events policy. Note the difference in naming from the cloudpassage.ServerGroup.create() method
  • alert_profiles (list) – List of alert profiles
Returns:

True if successful, throws exception otherwise.