Skip to content

liip/jelapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lint and Tests codecov

jelapi

A Jelastic API Python library

Installation

pip3 install jelapi

Usage

import jelapi

jelapi.api_url = "https://app.jpc.infomaniak.com/1.0/"
jelapi.api_token = "your-long-token"

jelenvs = jelapi.JelasticEnvironment.list()

jelenv = next(
    env
    for env in jelenvs.values()
    if all(eg in env.envGroups for eg in ["clients/envgroup", "prod"])
)

for ng in jelenv.nodeGroups.values():
    for n in ng.nodes:
        n.fixedCloudlets = 2

cpnodegroup = jelenv.nodeGroups("cp"]
cpnodegroup.nodes[0].fixedCloudlets = 2
cpnodegroup.envVars["AN_ENV_VARIABLE"] = "Content"

sqlnode = jelenv.nodeGroups["sqldb"].nodes[0]
sqlnode.flexibleCloudlets = max(sqlnode.flexibleCloudlets - 2, 0)
sqlnode.allowFlexibleCloudletsReduction = True

jelenv.save()