G42 Cloud SDK EVS

raw JSON →
0.0.10b0 verified Sat May 09 auth: no python

Elastic Volume Service (EVS) client library for G42 Cloud, part of the G42 Cloud Python SDK. Current version is 0.0.10b0 (beta), with monthly releases. Supports Python 2.7+ and 3.x. Allows management of cloud volumes, snapshots, and backups.

pip install g42cloudsdkevs
error ModuleNotFoundError: No module named 'g42cloudsdkevs'
cause Library not installed or wrong name used (e.g. 'g42cloudsdk-evs').
fix
Run pip install g42cloudsdkevs.
error ImportError: cannot import name 'EvsClient' from 'huaweicloudsdkevs'
cause Using wrong import path from the Huawei Cloud SDK instead of G42 SDK.
fix
Use from g42cloudsdkevs.v1 import EvsClient.
error huaweicloudsdkcore.exceptions.exceptions.ServiceResponseException: service error: AuthFailure
cause Invalid or expired credentials (AK/SK) or wrong project ID.
fix
Verify G42_AK, G42_SK, and G42_PROJECT_ID environment variables are set correctly.
gotcha The library name is 'g42cloudsdkevs' not 'g42cloudsdk-evs' or 'g42cloud-evssdk'. Install via pip install g42cloudsdkevs exactly.
fix Use `pip install g42cloudsdkevs`.
gotcha The package depends on huaweicloudsdkcore for base classes and authentication. It must be installed separately or as a dependency.
fix Install huaweicloudsdkcore: `pip install huaweicloudsdkcore`.

Initializes EVS client and lists volumes. Requires environment variables for authentication.

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcore.client import ClientBuilder
from g42cloudsdkevs.v1 import EvsClient
from g42cloudsdkevs.v1.model import ListVolumesRequest

ak = os.environ.get('G42_AK', '')
sk = os.environ.get('G42_SK', '')
project_id = os.environ.get('G42_PROJECT_ID', '')

credentials = BasicCredentials(ak, sk, project_id)
client = EvsClient.new_builder() \
    .with_credentials(credentials) \
    .with_endpoint('https://evs.g42cloud.com') \
    .with_region('global') \
    .build()

req = ListVolumesRequest()
resp = client.list_volumes(req)
print(resp)