class cloudpassage.ServerGroup(session)

Initializing the ServerGroup class:

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.


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

ID of newly-created group.

Return type:


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 a ServerGroup. In detail.

Parameters:group_id (str) – ID of group
Returns:Dictionary object describing group. In detail.
Return type:dict

Returns a list of all groups for an account

This is represented as a list of dictionaries

This will only return a maximum of 20 pages, which amounts to 200 groups. If you have more than that, you should consider using the SDK within a multi-threaded application so you don’t spend the rest of your life waiting on a list of groups.

list_connections(group_id, **kwargs)

This method retrieves all recently detected connections in the server group specified by Group ID

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

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)

This method all servers in listOfServers into the group identified by group_id.

  • grp_id (str) – ID of group to merge
  • server_ids (list) – A list of server_id
  • srv_state (str) – A comma-separated string containing.
  • state includes active,missing,deactivated,retired (Defult) –

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

Return type:


update(group_id, **kwargs)

Updates a ServerGroup.


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

True if successful, throws exception otherwise.