saml_attributes

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

Methods are accessible via zpa.saml_attributes

Copyright (c) 2023, Zscaler Inc.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

class SAMLAttributesAPI

Bases: APIClient

A client object for the SAML Attribute resource.

add_saml_attribute(**kwargs)

Add a new saml attribute for a given customer

Parameters:
  • name (str) – The customer-defined name for a SAML attribute.

  • user_attribute (bool) – Whether or not the user attribute is used.

  • idp_id (str) – The unique identifier of the IdP.

  • idp_name (str) – The name of the IdP.

  • saml_name (str) – Whether to enable the cloud browser isolation banner.

Returns:

A tuple containing the SAMLAttribute instance, response object, and error if any.

Return type:

tuple

Examples

>>> added_saml_attribute, _, err = client.zpa.saml_attributes.add_saml_attribute(
...     name='Custom_LastName_BD_Okta_Users',
...     idp_id='72058304855015574',
...     user_attribute=True,
... )
... if err:
...     print(f"Error configuring Saml Attribute: {err}")
...     return
... print(f"Saml Attribute added successfully: {added_saml_attribute.as_dict()}")
delete_saml_attribute(attribute_id, microtenant_id=None)

Deletes the specified Saml Attribute.

Parameters:

attribute_id (str) – The unique identifier for the Saml Attribute to be deleted.

Returns:

Status code of the delete operation.

Return type:

int

Example

Delete a Saml Attribute by ID

>>> _, _, err = client.zpa.saml_attributes.delete_saml_attribute('72058304855114335')
... if err:
...     print(f"Error deleting saml attribute: {err}")
...     return
... print(f"SAml Attribute with ID '72058304855114335' deleted successfully.")
get_saml_attribute(attribute_id, query_params=None)

Returns information on the specified SAML attribute.

Parameters:

attribute_id (str) – The unique identifier for the SAML attribute.

Returns:

A tuple containing the raw response data (dict), response object, and error if any.

Return type:

tuple

Examples

>>> fetched_admin, _, err = client.zpa.saml_attributes.get_saml_attribute('72058304855114335')
>>> if err:
...     print(f"Error fetching saml attribute by ID: {err}")
...     return
... print(f"Fetched saml attribute by ID: {fetched_admin.as_dict()}")
list_saml_attributes(query_params=None)

Returns a list of all configured SAML attributes.

Keyword Arguments:

{dict} (query_params) –

Map of query parameters for the request.

[query_params.page] {str}: Specifies the page number.

[query_params.page_size] {int}: Specifies the page size.

If not provided, the default page size is 20. The max page size is 500.

[query_params.search] {str}: The search string used to support search by features and fields for the API.

Returns:

A list of SAMLAttribute instances.

Return type:

list

Examples

>>> attributes_list, _, err = client.zpa.saml_attributes.list_saml_attributes(
...     query_params={"page": '1', "page_size": '10'}
... )
... if err:
...     print(f"Error listing SAML Attributes: {err}")
...     return
list_saml_attributes_by_idp(idp_id, query_params=None)

Returns a list of all configured SAML attributes for the specified IdP.

Parameters:

idp_id (str) – The unique id of the IdP to retrieve SAML attributes from.

Keyword Arguments:

{dict} (query_params) –

Map of query parameters for the request.

[query_params.page] {str}: Specifies the page number.

[query_params.page_size] {int}: Specifies the page size.

If not provided, the default page size is 20. The max page size is 500.

[query_params.search] {str}: The search string used to support search by features and fields for the API.

Returns:

A list of SAMLAttribute instances.

Return type:

list

Examples

>>> attributes_list, _, err = client.zpa.saml_attributes.list_saml_attributes_by_idp(
...     idp_id='15548452', query_params={"page": '1', "page_size": '10'}
... )
... if err:
...     print(f"Error listing SAML Attributes: {err}")
...     return
update_saml_attribute(attribute_id, **kwargs)

Updates the specified Saml Attribute.

Parameters:

attribute_id (str) – The unique identifier of the SAML attribute.

Returns:

SAMLAttribute: The updated Saml Attribute object.

Return type:

Tuple

Example

Basic example: Update an existing Saml Attribute

>>> updated_attribute, _, err = zpa.saml_attributes.update_saml_attribute(
...     attribute_id='72058304855114335',
...     name='Custom_LastName_BD_Okta_Users',
...     idp_id='72058304855015574',
...     user_attribute=True,
... )
... if err:
...     print(f"Error updating Saml Attribute: {err}")
...     return
... print(f"Saml Attribute updated successfully: {updated_attribute.as_dict()}")