Skip to content

Attribute

Attribute

Represents a key-value pair used for tagging entities.

Attributes:

Name Type Description
key str

The key of the attribute.

value str

The value of the attribute.

Methods:

Name Description
to_dict

Converts the attribute to a dictionary representation.

Source code in zenaura/client/tags/attribute.py
class Attribute:
    """
    Represents a key-value pair used for tagging entities.

    Attributes:
        key (str): The key of the attribute.
        value (str): The value of the attribute.

    Methods:
        to_dict(): Converts the attribute to a dictionary representation.
    """

    def __init__(self, key, value):
        """
        Initializes an Attribute object with the given key and value.

        Args:
            key (str): The key of the attribute.
            value (str): The value of the attribute.
        """
        self.key = key
        self.value = value

    def to_dict(self) -> dict:
        """
        Returns a dictionary representation of the attribute.

        Returns:
            dict: A dictionary containing the key and value of the attribute.
        """
        return {
            "key": self.key,
            "value": self.value
        }

__init__(key, value)

Initializes an Attribute object with the given key and value.

Parameters:

Name Type Description Default
key str

The key of the attribute.

required
value str

The value of the attribute.

required
Source code in zenaura/client/tags/attribute.py
def __init__(self, key, value):
    """
    Initializes an Attribute object with the given key and value.

    Args:
        key (str): The key of the attribute.
        value (str): The value of the attribute.
    """
    self.key = key
    self.value = value

to_dict()

Returns a dictionary representation of the attribute.

Returns:

Name Type Description
dict dict

A dictionary containing the key and value of the attribute.

Source code in zenaura/client/tags/attribute.py
def to_dict(self) -> dict:
    """
    Returns a dictionary representation of the attribute.

    Returns:
        dict: A dictionary containing the key and value of the attribute.
    """
    return {
        "key": self.key,
        "value": self.value
    }