provisioning#

The following methods allow for interaction with the ZPA Provisioning API endpoints.

Methods are accessible via zpa.provisioning

class ProvisioningAPI#
add_provisioning_key(key_type, name, max_usage, enrollment_cert_id, component_id, **kwargs)#

Adds a new provisioning key to ZPA.

Parameters:
  • key_type (str) –

    The type of provisioning key, accepted values are:

    connector and service_edge.

  • name (str) – The name of the provisioning key.

  • max_usage (int) – The maximum amount of times this key can be used.

  • enrollment_cert_id (str) – The unique id of the enrollment certificate that will be used for this provisioning key.

  • component_id (str) – The unique id of the component that this provisioning key will be linked to. For App Connectors, this will be the App Connector Group Id. For Service Edges, this will be the Service Edge Group Id.

  • **kwargs – Optional keyword args.

Keyword Arguments:

enabled (bool) – Enable the provisioning key. Defaults to True.

Returns:

The newly created Provisioning Key resource record.

Return type:

Box

Examples

Add a new App Connector Provisioning Key that can be used a maximum of 2 times.

>>> key = zpa.provisioning.add_provisioning_key(key_type="connector",
...    name="Example App Connector Provisioning Key",
...    max_usage=2,
...    enrollment_cert_id="99999",
...    component_id="888888")

Add a new Service Edge Provisioning Key in the disabled state that can be used once.

>>> key = zpa.provisioning.add_provisioning_key(key_type="service_edge",
...    name="Example Service Edge Provisioning Key",
...    max_usage=1,
...    enrollment_cert_id="99999",
...    component_id="777777"
...    enabled=False)
delete_provisioning_key(key_id, key_type)#

Deletes the specified provisioning key from ZPA.

Parameters:
  • key_id (str) – The unique id of the provisioning key that will be deleted.

  • key_type (str) –

    The type of provisioning key, accepted values are:

    connector and service_edge.

Returns:

The status code for the operation.

Return type:

int

Examples

Delete an App Connector provisioning key:

>>> zpa.provisioning.delete_provisioning_key(key_id="999999",
...    key_type="connector")

Delete a Service Edge provisioning key:

>>> zpa.provisioning.delete_provisioning_key(key_id="888888",
...    key_type="service_edge")
get_provisioning_key(key_id, key_type)#

Returns information on the specified provisioning key.

Parameters:
  • key_id (str) – The unique id of the provisioning key.

  • key_type (str) –

    The type of provisioning key, accepted values are:

    connector and service_edge.

Returns:

The requested provisioning key resource record.

Return type:

Box

Examples

Get the specified App Connector key.

>>> provisioning_key = zpa.provisioning.get_provisioning_key("999999",
...    key_type="connector")

Get the specified Service Edge key.

>>> provisioning_key = zpa.provisioning.get_provisioning_key("888888",
...    key_type="service_edge")
list_provisioning_keys(key_type, **kwargs)#

Returns a list of all configured provisioning keys that match the specified key_type.

Parameters:
  • key_type (str) –

    The type of provisioning key, accepted values are:

    connector and service_edge.

  • **kwargs – Optional keyword args.

Keyword Arguments:
  • **max_items (int, optional) – The maximum number of items to request before stopping iteration.

  • **max_pages (int, optional) – The maximum number of pages to request before stopping iteration.

  • **pagesize (int, optional) – 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 containing the requested provisioning keys.

Return type:

BoxList

Examples

List all App Connector provisioning keys.

>>> for key in zpa.provisioning.list_provisioning_keys(key_type="connector"):
...    print(key)

List all Service Edge provisioning keys.

>>> for key in zpa.provisioning.list_provisioning_keys(key_type="service_edge"):
...    print(key)
update_provisioning_key(key_id, key_type, **kwargs)#

Updates the specified provisioning key.

Parameters:
  • key_id (str) – The unique id of the Provisioning Key being updated.

  • key_type (str) –

    The type of provisioning key, accepted values are:

    connector and service_edge.

  • **kwargs – Optional keyword args.

Keyword Arguments:
  • name (str) – The name of the provisioning key.

  • max_usage (int) – The maximum amount of times this key can be used.

  • enrollment_cert_id (str) – The unique id of the enrollment certificate that will be used for this provisioning key.

  • component_id (str) – The unique id of the component that this provisioning key will be linked to. For App Connectors, this will be the App Connector Group Id. For Service Edges, this will be the Service Edge Group Id.

Returns:

The updated Provisioning Key resource record.

Return type:

Box

Examples

Update the name of an App Connector provisioning key:

>>> updated_key = zpa.provisioning.update_provisioning_key('999999',
...    key_type="connector",
...    name="Updated Name")

Change the max usage of a Service Edge provisioning key:

>>> updated_key = zpa.provisioning.update_provisioning_key('888888',
...    key_type="service_edge",
...    max_usage=10)