sedai.account
Get all accounts that are integrated with Sedai
Returns
A list of accounts Each account is an object with the following fields:
- id - the account id in Sedai
- name - the name of the account as specified by the user
- providerAccountId - the account id in the cloud provider
- accountDetails.cloudProvider - the cloud provider of the account. Values are:
AWS,AZURE,GCP,KUBERNETES,VMWARE - accountDetails.integrationType - the type of integration. Values are:
AGENTLESS,AGENT_BASED
Sample code:
models.to_json(account.get_all_accounts())
Output:
[
{
"id": "5f4f5d3a-9c6e-4b3e-8a5a-1e4b6b5b2a7e",
"name": "test env",
"accountDetails": {
"cloudProvider": "AWS",
"integrationType": "AGENTLESS"
}
}
]
Get a lightweight list of all accounts integrated with Sedai.
Faster than get_all_accounts() as it returns a reduced set of fields.
Use this when you only need basic account info such as id, name, cloudProvider.
Returns
A list of accounts with the following fields:
- id - the account id in Sedai
- name - the name of the account
- cloudProvider - the cloud provider. Values are:
AWS,AZURE,GCP,KUBERNETES - serviceProvider - the underlying service provider for Kubernetes clusters. Values are:
AWS,AZURE,GCP - enabled - whether the account is enabled
Search for all accounts that are integrated with Sedai that match the given provider account id
Parameters
- provider_account_id: The providerAccountId of the account to search for
Returns
A list of accounts that match the given providerAccountId. Output is in the same structure as
get_all_accounts()
Search for all accounts that are integrated with Sedai that match the given name
Parameters
- name: The name of the account to search for
Returns
A list of accounts that match the given name. Output is in the same structure as
get_all_accounts_lite()
Search for all accounts that are integrated with Sedai that match the given id
Parameters
- id: The accountId of the account to search for
Returns
A list of accounts that match the given id. Output is in the same structure as
get_all_accounts()
Create an account in Sedai
Parameters
- name: The name of the account
- cloud_provider: Cloud provider of the account. Valid values are:
AWS,AZURE,GCP,KUBERNETES - credentials: Credentials for the account. See :ref:
credentialsfor more details - integration_type: Type of integration for Kubernetes accounts. Valid values are:
AGENTLESS,AGENT_BASED - cluster_provider: Cluster provider for Kubernetes accounts. Required when adding Kubernetes clusters. Valid values are:
AWS,AZURE,GCP,SELF_MANAGED - cluster_url: URL of the Kubernetes cluster. Required when adding agentless Kubernetes clusters.
- ca_certificate: Optional Certifying Authority Certificate for connecting agentlessly to Kubernetes clusters.
- project_id: The GCP project id. Required when adding GCP accounts.
Returns
True if the account was created successfully, False otherwise
Update an account in Sedai
Parameters
- id: The id of the account
- name: The name of the account
- cloud_provider: Cloud provider of the account. Valid values are:
AWS,AZURE,GCP,KUBERNETES - credentials: Credentials for the account. See :ref:
credentialsfor more details - integration_type: Type of integration for Kubernetes accounts. Valid values are:
AGENTLESS,AGENT_BASED - cluster_provider: Cluster provider for Kubernetes accounts. Required when adding Kubernetes clusters. Valid values are:
AWS,AZURE,GCP,SELF_MANAGED - cluster_url: URL of the Kubernetes cluster. Required when adding agentless Kubernetes clusters.
- ca_certificate: Optional Certifying Authority Certificate for connecting agentlessly to Kubernetes clusters.
- project_id: The GCP project id. Required when adding GCP accounts.
- subscription_id: The Azure subscription id. Required when adding Azure accounts.
- tenant_id: The Azure tenant id. Required when adding Azure accounts.
Returns
True if the account was updated successfully, False otherwise
Delete an account in Sedai, looked up by name.
Account names are not unique in Sedai. If the name matches more than one account this raises
rather than deleting an arbitrary one - use delete_account_by_id() instead.
Parameters
- name: Name of the account to delete
Returns
True if the account was deleted successfully, False otherwise
Raises
- ValueError: If no account is found with the given name
- RuntimeError: If more than one account is found with the given name
Delete an account in Sedai
Parameters
- id: Id of the account to delete
Returns
True if the account was deleted successfully, False otherwise
Test the connection to the account
Parameters
- account_id: The Sedai account id
Returns
True if the connection was successful, False otherwise
Get the agent installation command for the given account
Parameters
- name: Name of the account
Returns
The agent installation command details Contains the following fields:
- accountId - The Sedai account id
- apiKey - The Sedai API key used for the command
- kubeInstallCmd - The kubectl command to install the agent on Kubernetes clusters
- helmInstallCmd - The helm command to install the agent on Kubernetes clusters
Output:
{
"accountId": "n9dngzfd",
"apiKey": "eyJhbGciOiJSUzI1NiJ9...[Truncated]",
"kubeInstallCmd": "kubectl apply -f “https://[Truncated. URL for the YAML file]“",
"helmInstallCmd": "helm upgrade --install sedai-smart-agent-abc oci://[...] --version 1.21.36 -f “https://[Truncated. URL for the YAML file]“]"
}
Raises
- ValueError: If no account is found with the given name
- RuntimeError: If more than one account is found with the given name
Get the agent installation command for the given account id
Parameters
- account_id: The Sedai account id
Returns
The agent installation command details, or None if the request failed Contains the following fields:
- accountId - The Sedai account id
- apiKey - The Sedai API key used for the command
- kubeInstallCmd - The kubectl command to install the agent on Kubernetes clusters
- helmInstallCmd - The helm command to install the agent on Kubernetes clusters
Output:
{
"accountId": "n9dngzfd",
"apiKey": "eyJhbGciOiJSUzI1NiJ9...[Truncated]",
"kubeInstallCmd": "kubectl apply -f “https://[Truncated. URL for the YAML file]“",
"helmInstallCmd": "helm upgrade --install sedai-smart-agent-abc oci://[...] --version 1.21.36 -f “https://[Truncated. URL for the YAML file]“]"
}