server_groups#
The following methods allow for interaction with the ZPA Server Groups API endpoints.
Methods are accessible via zpa.server_groups
- class ServerGroupsAPI#
Bases:
object
- add_group(app_connector_group_ids, name, **kwargs)#
Adds a server group.
- Parameters:
- Keyword Arguments:
application_ids (
list
ofstr
) – A list of unique IDs of applications to associate with this server group.config_space (str) – The configuration space. Accepted values are DEFAULT or SIEM.
description (str) – Additional information about the server group.
enabled (bool) – Enable the server group.
ip_anchored (bool) – Enable IP Anchoring.
dynamic_discovery (bool) – Enable Dynamic Discovery.
server_ids (
list
ofstr
) – A list of unique IDs of servers to associate with this server group.
- Returns:
The resource record for the newly created server group.
- Return type:
Box
Examples
Create a server group with the minimum params:
>>> zpa.server_groups.add_group('new_server_group' ... app_connector_group_ids['99999'])
Create a server group and define a new server on the fly:
>>> zpa.server_groups.add_group('new_server_group', ... app_connector_group_ids=['99999'], ... enabled=True, ... servers=[{ ... 'name': 'new_server', ... 'address': '10.0.0.30', ... 'enabled': True}])
- delete_group(group_id)#
Deletes the specified server group.
- Parameters:
group_id (str) – The unique id for the server group to be deleted.
- Returns:
The response code for the operation.
- Return type:
Examples
>>> zpa.server_groups.delete_group('99999')
- get_group(group_id)#
Provides information on the specified server group.
- Parameters:
group_id (str) – The unique id for the server group.
- Returns:
The resource record for the server group.
- Return type:
Box
Examples
>>> pprint(zpa.server_groups.get_group('99999'))
- get_server_group_by_name(name)#
- list_groups(**kwargs)#
Returns a list of all configured server groups.
- Keyword Arguments:
**max_items (int) – The maximum number of items to request before stopping iteration.
**max_pages (int) – The maximum number of pages to request before stopping iteration.
**pagesize (int) – Specifies the page size. The default size is 20, but the maximum size is 500.
**search (str, optional) – The search string used to match against features and fields.
- Returns:
A list of all configured server groups.
- Return type:
BoxList
Examples
>>> for server_group in zpa.server_groups.list_groups(): ... pprint(server_group)
- reformat_params = [('application_ids', 'applications'), ('server_ids', 'servers'), ('app_connector_group_ids', 'appConnectorGroups')]#
- update_group(group_id, **kwargs)#
Updates a server group.
- Parameters:
group_id (str, required) – The unique identifier for the server group.
**kwargs – Optional keyword args.
- Keyword Arguments:
app_connector_group_ids (
list
ofstr
) – A list of application connector IDs that will be attached to the server group.application_ids (
list
ofstr
) – A list of unique IDs of applications to associate with this server group.config_space (str) – The configuration space. Accepted values are DEFAULT or SIEM.
description (str) – Additional information about the server group.
enabled (bool) – Enable the server group.
ip_anchored (bool) – Enable IP Anchoring.
dynamic_discovery (bool) – Enable Dynamic Discovery.
server_ids (
list
ofstr
) – A list of unique IDs of servers to associate with this server group
- Returns:
The resource record for the updated server group.
- Return type:
Box
Examples
Update the name of a server group:
>>> zpa.server_groups.update_group(name='Updated Name')
Enable IP anchoring and Dynamic Discovery:
>>> zpa.server_groups.update_group(ip_anchored=True, ... dynamic_discovery=True)