servers#
The following methods allow for interaction with the ZPA Application Servers API endpoints.
Methods are accessible via zpa.servers
- class AppServersAPI#
Bases:
object
- add_server(name, address, enabled=True, **kwargs)#
Add a new application server.
- Parameters:
- Keyword Arguments:
- Returns:
The resource record for the newly created server.
- Return type:
Box
Examples
Create a server with the minimum required parameters:
>>> zpa.servers.add_server( ... name='myserver.example', ... address='192.0.2.10', ... enabled=True)
- delete_server(server_id)#
Delete the specified server.
The server must not be assigned to any Server Groups or the operation will fail.
- Parameters:
server_id (str) – The unique identifier for the server to be deleted.
- Returns:
The response code for the operation.
- Return type:
Examples
>>> zpa.servers.delete_server('99999')
- get_server(server_id)#
Gets information on the specified server.
- Parameters:
server_id (str) – The unique identifier for the server.
- Returns:
The resource record for the server.
- Return type:
Box
Examples
>>> server = zpa.servers.get_server('99999')
- get_server_by_name(name)#
- list_servers(**kwargs)#
Returns all configured servers.
- 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:
List of all configured servers.
- Return type:
BoxList
Examples
>>> servers = zpa.servers.list_servers()
- update_server(server_id, **kwargs)#
Updates the specified server.
- Parameters:
server_id (str) – The unique identifier for the server being updated.
**kwargs – Optional keyword args.
- Keyword Arguments:
name (str) – The name of the server.
address (str) – The IP address of the server.
enabled (bool) – Enable the server.
description (str) – A description for the server.
app_server_group_ids (list) – Unique identifiers for the server groups the server belongs to.
config_space (str) – The configuration space for the server.
- Returns:
The resource record for the updated server.
- Return type:
Box
Examples
Update the name of a server:
>>> zpa.servers.update_server( ... '99999', ... name='newname.example')
Update the address and enable a server:
>>> zpa.servers.update_server( ... '99999', ... address='192.0.2.20', ... enabled=True)