sedai.groups
This class represents a group definition in Sedai. A group definition is used to define a group of resources This class is used to create and update groups in Sedai . Initialize a new group definition with the given name
Create a new GroupDefinition by copying an existing definition
Set the auto refresh of the group. Default is False
Parameters
- auto_refresh:
Get the auto refresh setting of the group. When a resource is set to auto refresh, Sedai will frequently check for new resources that match the group's constraints and add them to the group. It will also remove resources that no longer match the constraints.
Returns
Set the parentGroupId of the group
Parameters
- parent_group_id:
Returns
Get the parentGroupId of the group
Returns
The parentGroupId of the group
Add a tag to the group definition. The tags are used to filter resources that are added to the group.
Parameters
- key: The tag key
- value: The tag value
Returns
None
Remove a tag from the group definition.
Parameters
- key: The tag key
- value: The tag value to remove. If not provided, the entire tag is removed.
Returns
Add a cluster identified by the cluster ID or name to the group definition.
Parameters
- cluster_id: The ID of the cluster to add. This is the fully qualified name of the cluster, such as the ARN of an AWS cluster
- cluster_name: The name of the cluster to add. Either the cluster name or the cluster ID must be provided.
Returns
None
Remove a cluster identified by the cluster id of cluster name from the group definition
Parameters
- cluster_id: The id of the cluster to remove.
- cluster_name: The name of the cluster to remove. Either the cluster name or id must be provided.
Returns
None
Add a region to the group definition
Parameters
- region: The region to add
Returns
None
Remove a region from the group definition
Parameters
- region: The region to remove
Returns
None
Add a namespace to the group definition
Parameters
- namespace: The namespace to add
Returns
None
Remove a namespace from the group definition
Parameters
- namespace: The namespace to remove
Returns
None
Add an account_id to the group definition
Parameters
- account_id: The account_id to add
Returns
None
Remove an account_id from the group definition
Parameters
- account_id: The account_id to remove
Returns
None
Add a resource type to the group definition
Parameters
- resource_type: The resource type to add
Returns
None
Remove a resource type from the group definition
Parameters
- resource_type: The resource type to remove
Returns
None
Must contain:
- groupId: str
- name: str
- definition: GroupDefinition (or object with .to_json())
Get all groups that are integrated with Sedai
Returns
A list of groups Each entry is an object with the following fields:
- id - the group id in within Sedai
- name - the name of the group (str)
Search for all groups that are integrated with Sedai that match the given name
Parameters
- name: The name of the group to search for
Returns
A list of groups that match the given id. Output is in the same structure as
get_all_groups()
Search for all groups that are integrated with Sedai that match the given id
Parameters
- id: The groupId of the group to search for
Returns
A list of groups that match the given name. Output is in the same structuredef get_group_details(name): as
get_all_groups()
Get the details of a group. This includes the group definition and the details of the real-time resources Thiis includes the following fields:
- definition - The group definition
- groupId - The group id in within Sedai
- name - the name of the group (str)
- awsLbCount - The number of AWS Load Balancers in the group
- awsTagsCount - The number of AWS Tags in the group
- azureLbCount - The number of Azure Load Balancers in the group
- azureTagsCount - The number of Azure Tags in the group
- azureVmCount - The number of Azure Virtual Machines in the group
- ebsCount - The number of AWS Elastic Block Storage in the group
- ec2Count - The number of AWS EC2 instances in the group
- ecsCount - The number of AWS ECS instances in the group
- kubeCount - The number of Kubernetes resources in the group
- lambdaCount - The number of AWS Lambda functions in the group
- s3Count - The number of AWS S3 buckets in the group
- streamingCount - The number of streaming resources in the group
Parameters
- name: The name of the group to search for
Returns
The group details
Raises
- Exception: If more than one group is found with the same name
Get the details of a group. This includes the group definition and the details of the real-time resources This includes the following fields:
- groupId - the id of the group (str)
- definition - The group definition
- name - the name of the group (str)
- groupKind - the kind of the group (str) if exists - can be ACCOUNT, RESOURCE_GROUP, NAMESPACE, SUB_GROUP
- parentId - the parent group id of the group if its the subgroup
- awsLbCount - The number of AWS Load Balancers in the group
- awsTagsCount - The number of AWS Tags in the group
- azureLbCount - The number of Azure Load Balancers in the group
- azureTagsCount - The number of Azure Tags in the group
- azureVmCount - The number of Azure Virtual Machines in the group
- ebsCount - The number of AWS Elastic Block Storage in the group
- ec2Count - The number of AWS EC2 instances in the group
- ecsCount - The number of AWS ECS instances in the group
- kubeCount - The number of Kubernetes resources in the group
- lambdaCount - The number of AWS Lambda functions in the group
- s3Count - The number of AWS S3 buckets in the group
- streamingCount - The number of streaming resources in the group
Parameters
- group_id: The id of the group whose details is to be fetched
Returns
The group details
Updates a Sedai Group definition
Parameters
- group: Group object with attributes groupId, name, and definition
Returns
True if update succeeded, False otherwise
Create a Sedai group.
Parameters
- group: GroupDefinition object to create. Must include
name. Optional fields: tags, cluster, cloud, resourceType, manuallyAddedResources, region, namespace, autoRefresh, parentGroupId.
Returns
True if the group was successfully created, False otherwise.
Raises
- Exception: If a group with the same name already exists.
Delete a group from Sedai
Parameters
- group_id: The id of the group to delete
Returns
True if successful, False otherwise