数字能源 API 的 Python 包装器
项目描述
PyDigitalEnergy 是一个 Python 包,允许简单地访问数字能源虚拟化管理平台 API。
安装
Python 3.7+ 支持 PyDigitalEnergy。推荐的安装方式是通过pip。
pip install pydigitalenergy
有关安装 Python 和 pip 的说明,请参阅“The Hitchhiker's Guide to Python”安装指南。
结构概述
由于Digital Energy是一个虚拟化管理平台。在这里您可以看到高级结构:
└── Grid (Data Center) # Logical entity that defines the set of resources
└── Grid Node(CLuster) # Logical grouping of hosts
└── Stack (Host) # Also known as hypervisors, are the physical servers
└── Compute (Virtual Machine)
快速开始
假设你已经有一个凭证,你可以像这样实例化一个 DigitalEnergyAPI 实例:
from pydigitalenergy import DigitalEnergyApi
api = DigitalEnergyApi(
hostname = 'Digital Energy host',
client_id = 'Your identifier',
client_secret = 'Your secret key'
)
通过该api实例,您可以与 Digital Energy 进行交互。您可以在下面找到几个示例。
计算/虚拟机
在计算中,虚拟机 (VM) 是计算机系统的虚拟化/仿真。
# Get list of computes
computes = api.cloudbroker.computes.list()
# Or you can use more convenient alias
vms = api.cloudbroker.virtual_machines.list()
# To get one particular instance you should use .get() method
# For example with ID = 42
vm = api.cloudbroker.virtual_machines.get(42)
堆栈/主机
主机,也称为管理程序,是运行虚拟机的物理服务器
# Get list of stacks
stacks = api.cloudbroker.stacks.list()
# Or you can use more convenient alias
hosts = api.cloudbroker.hosts.list()
# To get one particular instance you should use .get() method
# For example with ID = 4
host = api.cloudbroker.hosts.get(4)
节点/集群
集群是共享相同存储域并具有相同类型 CPU 的主机的逻辑分组
# Get list of nodes
nodes = api.cloudbroker.nodes.list()
# Or you can use more convenient alias
clusters = api.cloudbroker.clusters.list()
# To get one particular instance you should use .get() method
# For example with ID = 10
cluster = api.cloudbroker.clusters.get(10)
网格/数据中心
数据中心是定义在特定环境中使用的资源集的逻辑实体
# Get list of stacks
grids = api.cloudbroker.grid.list()
# Or you can use more convenient alias
dcs = api.cloudbroker.data_centers.list()
# To get one particular instance you should use .get() method
# For example with ID = 1
host = api.cloudbroker.data_centers.get(1)
可用方法列表
您可以在详细文档中找到更多方法。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
PyDigitalEnergy-0.0.3.tar.gz
(18.9 kB
查看哈希)
内置分布
PyDigitalEnergy-0.0.3-py3-none-any.whl
(26.0 kB
查看哈希)
关
PyDigitalEnergy -0.0.3.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 18dd1af13eee1ed16aee4c831962118a546fa9f1e0e3eeb74d7e1b450db384f3 |
|
| MD5 | 78fcd99e59e97bd464f9c0d9ddd658c0 |
|
| 布莱克2-256 | 0bb9c5ae755b6450bfdcf4df261bd3c21b265986370229e42527e3f2add87bf2 |
关
PyDigitalEnergy -0.0.3-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 874ddcbd1727f14a0927183008eaf2d049c0fb0b3a94a7df678d24333cae0612 |
|
| MD5 | a79698a319500b86ec35ad3a0ba69f9f |
|
| 布莱克2-256 | 426cb69ee30a546fd5196a2032b2d8411f8fdff10b3659e0a98a37a1aec1709a |