bandwidth_classes

The following methods allow for interaction with the ZIA Bandwidth Classes API endpoints.

Methods are accessible via zia.bandwidth_classes

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 BandwidthClassesAPI

Bases: APIClient

A Client object for the Bandwidth Classes resource.

add_class(**kwargs)

Creates a new ZIA Bandwidth Class.

Keyword Arguments:
  • name (str) – Name of the bandwidth class

  • web_applications (list of str) – The web conferencing applications included in the bandwidth class.

  • urls (list of str) – The rule state. Accepted values are ‘ENABLED’ or ‘DISABLED’.

  • url_categories (list of str) – The URL categories to add to the bandwidth class

Returns:

A tuple containing the newly added Bandwidth Class, response, and error.

Return type:

tuple

Examples

Create Bandwidth Classes:

>>> added_class, _, error = client.zia.bandwidth_classes.add_class(
...     name=f"NewBDW_{random.randint(1000, 10000)}",
...     web_applications=["ACADEMICGPT", "AD_CREATIVES"],
...     urls=["chatgpt.com"],
...     url_categories=["ADULT_THEMES", "ADULT_SEX_EDUCATION"],
... )
>>> if error:
...     print(f"Error adding class: {error}")
...     return
... print(f"Class added successfully: {added_class.as_dict()}")
delete_class(class_id)

Deletes the specified Bandwidth Class.

Parameters:

class_id (int) – The unique identifier of the Bandwidth Class.

Returns:

A tuple containing the response object and error (if any).

Return type:

tuple

Examples

Delete a Bandwidth Classes:

>>> _, _, error = client.zia.bandwidth_classes.delete_class('125454')
>>>     if error:
...         print(f"Error deleting class: {error}")
...         return
...     print(f"Class with ID {'125454'} deleted successfully.")
get_class(class_id)

Fetches a specific bandwidth class by ID.

Parameters:

class_id (int) – The unique identifier for the Bandwidth Class.

Returns:

A tuple containing (Bandwidth Class instance, Response, error).

Return type:

tuple

Examples

List Bandwidth Classes All:

>>> fetched_class, _, error = client.zia.bandwidth_classes.get_class(updated_class.id)
>>>     if error:
...         print(f"Error fetching class by ID: {error}")
...         return
...     print(f"Fetched class by ID: {fetched_class.as_dict()}")
list_classes(query_params=None)

Retrieves a list of bandwidth classes for an organization.

Parameters:

{dict} (query_params) –

Map of query parameters for the request.

[query_params.search] {str}: Search string for filtering results.

Returns:

A tuple containing (list of Bandwidth Classs instances, Response, error)

Return type:

tuple

Examples

List Bandwidth Classes All:

>>> classes_list, _, error = client.zia.bandwidth_classes.list_classes(
    query_params={'search': BWD_Classes01})
>>> if error:
...     print(f"Error listing classes: {error}")
...     return
... print(f"Total Classes found: {len(classes_list)}")
... for bwd in classes_list:
...     print(bwd.as_dict())
list_classes_lite()

Fetches a specific bandwidth class lite by ID.

Parameters:

bwd_id (int) – The unique identifier for the Bandwidth Class Lite.

Returns:

A tuple containing (Bandwidth Class instance, Response, error).

Return type:

tuple

Examples

List Bandwidth Classes All:

>>> classes_list, _, error = client.zia.bandwidth_classes.list_classes_lite(
    query_params={'search': BWD_Classes01})
>>> if error:
...     print(f"Error listing classes: {error}")
...     return
... print(f"Total Classes found: {len(classes_list)}")
... for bwd in classes_list:
...     print(bwd.as_dict())
update_class(class_id, **kwargs)

Updates information for the specified ZIA Bandwidth Class.

Parameters:

class_id (int) – The unique ID for the Bandwidth Class.

Returns:

A tuple containing the updated Bandwidth Class, response, and error.

Return type:

tuple

Examples

Update Bandwidth Classes:

>>> updated_class, _, error = client.zia.bandwidth_classes.update_class(
...     class_id='125245'
...     name=f"UpdateBDW_{random.randint(1000, 10000)}",
...     web_applications=["ACADEMICGPT", "AD_CREATIVES"],
...     urls=["chatgpt.com"],
...     url_categories=["ADULT_THEMES", "ADULT_SEX_EDUCATION"],
... )
>>> if error:
...     print(f"Error adding class: {error}")
...     return
... print(f"Class added successfully: {updated_class.as_dict()}")