sedai.account

CLOUD_PROVIDERS = ['AWS', 'AZURE', 'GCP', 'KUBERNETES']
INTEGRATION_TYPES = ['AGENTLESS', 'AGENT_BASED']
CLUSTER_PROVIDERS = ['AWS', 'AZURE', 'GCP', 'SELF_MANAGED']
def get_all_accounts():

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
  • 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"
        }
    }
]
def search_accounts_by_name(name):

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

def search_accounts_by_id(id):

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

def create_account( name: str, cloud_provider: str, credentials: sedai.credentials.SedaiCredentials, integration_type: str, cluster_provider: Optional[str] = None, cluster_url: Optional[str] = None, ca_certificate: Optional[str] = None):

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: credentials for 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.
Returns

True if the account was created successfully, False otherwise

def delete_account(name):

Delete an account in Sedai

Parameters
  • name: Name of the account to delete
Returns

True if the account was deleted successfully, False otherwise

def get_agent_installation_command(name):

Get the agent installation command for the given account

Parameters
  • name: Name of tMhe 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]“]"
}