Component Groups¶
Resource¶
Methods¶
-
ComponentGroup.
__init__
(manager, data)¶ Resource initializer.
- Parameters
manager – The manager this resource belongs to
data – The raw json data
-
ComponentGroup.
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
-
ComponentGroup.
get
(name) → Union[int, str, float, bool]¶ Safely obtain any attribute name for the resource
- Parameters
name (str) – Key name in json response
- Returns
Value from the raw json response. If the key doesn’t exist
None
is returned.
-
ComponentGroup.
delete
() → None¶ Deletes the resource from the server
Attributes¶
-
ComponentGroup.
attrs
¶ The raw json response from the server
- Type
dict
-
ComponentGroup.
id
¶ Id of the component group
- Type
int
-
ComponentGroup.
name
¶ Set or get name of component group
- Type
str
-
ComponentGroup.
enabled_components
¶ Enabled components in this group
- Type
List[Component]
-
ComponentGroup.
order
¶ Get or set order value for group
- Type
int
-
ComponentGroup.
collapsed
¶ Get or set collapsed status. See
enums
module for values.- Type
int
-
ComponentGroup.
lowest_human_status
¶ Lowest component status, human readable
- Type
str
-
ComponentGroup.
is_collapsed
¶ Does the current collapsed value indicate the group is collapsed? Note that the collapsed value may also indicate the group is not operational.
- Type
bool
-
ComponentGroup.
is_open
¶ Does the current collapsed value indicate the group is open? Note that the collapsed value may also indicate the group is not operational.
- Type
bool
-
ComponentGroup.
is_operational
¶ Does the current collapsed value indicate the group not operational?
- Type
bool
-
ComponentGroup.
created_at
¶ When the group was created
- Type
datetime
-
ComponentGroup.
updated_at
¶ Last time updated
- Type
datetime
-
ComponentGroup.
visible
¶ Get or set visibility of the group
- Type
bool
Manager¶
Methods¶
-
ComponentGroupManager.
__init__
(http_client: cachetclient.httpclient.HttpClient, components_manager: cachetclient.v1.components.ComponentManager)¶ Manager initializer.
- Parameters
http_client – The httpclient
-
ComponentGroupManager.
create
(*, name: str, order: int = 0, collapsed: int = 0, visible: bool = False) → cachetclient.v1.component_groups.ComponentGroup¶ Create a component group
- Keyword Arguments
name (str) – Name of the group
order (int) – group order
collapsed (int) – Collapse value (see enums)
visible (bool) – Publicly visible group
- Returns
ComponentGroup
instance
-
ComponentGroupManager.
update
(group_id: int, *, name: str, order: int = None, collapsed: int = None, visible: bool = None, **kwargs) → cachetclient.v1.component_groups.ComponentGroup¶ Update component group
- Parameters
group_id (int) – The group id to update
- Keyword Arguments
name (str) – New name for group
order (int) – Order value of the group
collapsed (int) – Collapsed value. See enums module.
visible (bool) – Publicly visible group
-
ComponentGroupManager.
count
() → int¶ Count the number of component groups
- Returns
Number of component groups
- Return type
int
-
ComponentGroupManager.
list
(page: int = 1, per_page: int = 20) → Generator[cachetclient.v1.component_groups.ComponentGroup, None, None]¶ List all component groups
- Keyword Arguments
page (int) – The page to start listing
per_page – Number of entries per page
- Returns
Generator of
ComponentGroup
instances
-
ComponentGroupManager.
get
(group_id) → cachetclient.v1.component_groups.ComponentGroup¶ Get a component group by id
- Parameters
group_id (int) – Id of the component group
- Returns
ComponentGroup
instance- Raises
requests.exceptions.HttpError – if not found
-
ComponentGroupManager.
delete
(group_id: int) → None¶ Delete a component group
- Parameters
group_id (int) – Id of the component
- Raises
requests.exceptions.HttpError – if not found
-
ComponentGroupManager.
instance_from_dict
(data: dict) → cachetclient.base.Resource¶ Creates a resource instance from a dictionary.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from dictionary data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (dict) – dictionary containing the instance data
- Returns
The resource class instance
- Return type
Resource
-
ComponentGroupManager.
instance_from_json
(data: str) → cachetclient.base.Resource¶ Creates a resource instance from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from json data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (str) – json string containing the instance data
- Returns
The resource class instance
- Return type
Resource
-
ComponentGroupManager.
instance_list_from_json
(data: str) → List[cachetclient.base.Resource]¶ Creates a resource instance list from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instances from json data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (str) – json string containing the instance data
- Returns
The resource class instance
- Return type
Resource
- Raises
ValueError – if json data do not deserialize into a list