tag_namespace¶
The following methods allow for interaction with the ZPA Tag Namespace API endpoints. Tag namespaces provide a way to organize and scope tag keys in your ZPA environment.
Methods are accessible via zpa.tag_namespace
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 TagNamespaceAPI¶
Bases:
APIClientA client object for the Tag Namespace resource.
- create_namespace(namespace, query_params=None)¶
Create a tag namespace.
- Parameters:
namespace (Namespace) – The namespace object to create.
query_params (dict, optional) – Map of query parameters.
[query_params.microtenant_id](str): ID of the microtenant.
- Returns:
(Namespace, Response, error).
- Return type:
Examples
>>> ns = Namespace({"name": "MyNS", "enabled": True}) >>> created, _, err = client.zpa.tag_namespace.create_namespace(ns) >>> if err: ... print(err)
- delete_namespace(namespace_id, query_params=None)¶
Delete a tag namespace.
- Parameters:
- Returns:
(None, Response, error).
- Return type:
Examples
>>> _, _, err = client.zpa.tag_namespace.delete_namespace("123") >>> if err: ... print(err)
- get_namespace(namespace_id, query_params=None)¶
Get a tag namespace by ID.
- Parameters:
- Returns:
(Namespace, Response, error).
- Return type:
Examples
>>> ns, _, err = client.zpa.tag_namespace.get_namespace("123456") >>> if err: ... print(err) >>> print(ns.as_dict())
- get_namespace_by_name(namespace_name, query_params=None)¶
Get a tag namespace by name (case-insensitive).
- Parameters:
- Returns:
(Namespace, Response, error).
- Return type:
Examples
>>> ns, _, err = client.zpa.tag_namespace.get_namespace_by_name("MyNamespace") >>> if err: ... print(err) >>> print(ns.as_dict())
- list_namespaces(query_params=None)¶
Get all tag namespaces.
- Parameters:
query_params (dict, optional) – Map of query parameters.
[query_params.microtenant_id](str): ID of the microtenant, if applicable.- Returns:
(list of Namespace, Response, error).
- Return type:
Examples
>>> namespaces, _, err = client.zpa.tag_namespace.list_namespaces() >>> if err: ... print(err) >>> for ns in namespaces: ... print(ns.as_dict())
Client-side filtering with JMESPath:
The response object supports client-side filtering and projection via
resp.search(expression). See the JMESPath documentation for expression syntax.
- update_namespace(namespace_id, namespace, query_params=None)¶
Update a tag namespace.
- Parameters:
- Returns:
(Namespace, Response, error).
- Return type:
Examples
>>> ns.name = "UpdatedName" >>> updated, resp, err = client.zpa.tag_namespace.update_namespace("123", ns) >>> if err: ... print(err)
- update_namespace_status(namespace_id, status_update, query_params=None)¶
Update the enabled status of a tag namespace.
- Parameters:
- Returns:
(None, Response, error).
- Return type:
Examples
>>> status = UpdateStatusRequest({"enabled": False}) >>> _, _, err = client.zpa.tag_namespace.update_namespace_status("123", status) >>> if err: ... print(err)