Components¶
Resource¶
Methods¶
-
Component.
add_tag
(name: str) → None¶ Add a new tag.
Parameters: name (str) – Name of the tag
-
Component.
del_tag
(name: str) → None¶ Delete a tag.
Parameters: name (str) – Name of tag to remove Raises: KeyError
– if tag does not exist
-
Component.
has_tag
(name: str) → bool¶ Check if a tag exists.
Parameters: name (str) – Tag name Returns: If the tag exists Return type: bool
-
Component.
update
()¶ Posts the values in the resource to the server.
Example:
# Change an attribute and save the resource >> resource.value = something >> updated_resource = resource.update()
Returns: The updated resource from the server
-
Component.
delete
() → None¶ Deletes the resource from the server
Attributes¶
-
Component.
id
¶ The unique ID of the component
Type: int
-
Component.
name
¶ Get or set name of the component
Type: str
-
Component.
description
¶ Get or set component description
Type: str
-
Component.
link
¶ Get or set http link to the component
Type: str
-
Component.
status
¶ Get or set dtatus id of the component (see
enums
)Type: int
-
Component.
status_name
¶ Human readable status representation
Type: str
-
Component.
order
¶ Get or set order of the component in a group
Type: int
-
Component.
group_id
¶ Get or set the component group id
Type: int
-
Component.
enabled
¶ Get or set enabled state
Type: bool
-
Component.
created_at
¶ When the component was created
Type: datetime
-
Component.
updated_at
¶ Last time the component was updated
Type: datetime
Manager¶
-
ComponentManager.
create
(*, name: str, status: int, description: str = None, link: str = None, order: int = None, group_id: int = None, enabled: bool = True, tags: Set[str] = None)¶ Create a component.
Keyword Arguments: - name (str) – Name of the component
- status (int) – Status if of the component (see enums module)
- description (str) – Description of the component (required)
- link (str) – Link to the component
- order (int) – Order of the component in its group
- group_id (int) – The group it belongs to
- enabled (bool) – Enabled status
- tags (list) – String tags
Returns: Component
instance
-
ComponentManager.
update
(component_id: int, *, status: int, name: str = None, description: str = None, link: str = None, order: int = None, group_id: int = None, enabled: bool = None, tags: Set[str] = None, **kwargs) → cachetclient.v1.components.Component¶ Update a component by id.
Parameters: component_id (int) – The component to update
Keyword Arguments: - status (int) – Status of the component (see enums)
- name (str) – New name
- description (str) – New description
- link (str) – Link to component
- order (int) – Order in component group
- group_id (int) – Component group id
- enabled (bool) – Enable status of component
- tags (list) – List of strings
Returns: Updated Component from server
-
ComponentManager.
list
(page: int = 1, per_page: int = 20) → Generator[cachetclient.v1.components.Component, None, None]¶ List all components
Keyword Arguments: - page (int) – The page to start listing
- per_page (int) – Number of entires per page
Returns: Generator of Component instances
-
ComponentManager.
get
(component_id: int) → cachetclient.v1.components.Component¶ Get a component by id
Parameters: component_id (int) – Id of the component Returns: Component instance Raises: HttpError
– if not found
-
ComponentManager.
count
() → int¶ Count the number of components
Returns: Total number of components Return type: int
-
ComponentManager.
delete
(component_id: int) → None¶ Delete a component
Parameters: component_id (int) – Id of the component Raises: HTTPError
– if compontent do not exist