sedai.groups

class GroupDefinition:
GroupDefinition(name)

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

def set_name(self, name):

Set the name of the group

Parameters
  • name:
Returns
def get_name(self):

Get the name of the group

Returns

The name of the group

def set_auto_refresh(self, auto_refresh: bool):

Set the auto refresh of the group. Default is False

Parameters
  • auto_refresh:
def get_auto_refresh(self):

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
def add_tag(self, key, value):

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

def remove_tag(self, key, value=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
def add_cluster(self, cluster_id=None, cluster_name=None):

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

def remove_cluster(self, cluster_id: str = None, cluster_name: str = 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

def add_region(self, region):

Add a region to the group definition

Parameters
  • region: The region to add
Returns

None

def remove_region(self, region):

Remove a region from the group definition

Parameters
  • region: The region to remove
Returns

None

def add_namespace(self, namespace):

Add a namespace to the group definition

Parameters
  • namespace: The namespace to add
Returns

None

def remove_namespace(self, namespace):

Remove a namespace from the group definition

Parameters
  • namespace: The namespace to remove
Returns

None

def add_account_id(self, account_id):

Add an account_id to the group definition

Parameters
  • account_id: The account_id to add
Returns

None

def remove_account_id(self, account_id):

Remove an account_id from the group definition

Parameters
  • account_id: The account_id to remove
Returns

None

def add_resource_type(self, resource_type):

Add a resource type to the group definition

Parameters
  • resource_type: The resource type to add
Returns

None

def remove_resource_type(self, resource_type):

Remove a resource type from the group definition

Parameters
  • resource_type: The resource type to remove
Returns

None

def add_resource_id(self, resource_id):

Add a resource id to the group definition

Parameters
  • resource_id: The resource id to add
Returns

None

def remove_resource_id(self, resource_id):

Remove a resource id from the group definition

Parameters
  • resource_id: The resource id to remove
Returns

None

def get_all_groups():

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)
def search_groups_by_name(name):

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()

def search_groups_by_id(id):

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()

def get_group(name):

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
def update_group(group):
def create_group(group: GroupDefinition):

Create group in Sedai

Parameters
  • group: The group to create
Returns

True if successful, False otherwise

Raises
  • Exception: If a group with the same name already exists.
def delete_group(group_id):

Delete a group from Sedai

Parameters
  • group_id: The id of the group to delete
Returns

True if successful, False otherwise