与genesiscloud交互的库

py-genesiscloud的Python项目详细描述


py基因云

Documentation Status

genesiscloud交互的库

演示

初始化客户端:

>>> from genesiscloud.client import Client
>>> client = Client("yourapikey")

列出可用的SSH密钥:

^{pr2}$

列出可用于创建实例的所有图像:

>>> [i for i in client.Images.find({"type": 'base-os'})]
[Image({'id': '45d06539-f8f5-48d9-816e-d4b1a8e5163e', 'name': 'Ubuntu 18.04', 'type': 'base-os', 'created_at': '2020-03-24T18:14:01.223Z'}),
 Image({'id': '6d5c3613-f6cb-48e1-8711-14f084060209', 'name': 'Ubuntu 16.04', 'type': 'base-os', 'created_at': '2020-03-24T18:14:01.219Z'})]

创建实例

>>> client.Instances.create(name='test-oz', hostname='hostname',
                            sshkeys=['650e5ecb-4e28-4a24-bfbf-ac4212f7e137']
                            type='vcpu-4_memory-12g_disk-80g_nvidia1080ti-1',
                            "image"='45d06539-f8f5-48d9-816e-d4b1a8e5163e',
                            "metadata"={"startup_script":"#!/bin/bash\nsudo apt update && sudo apt install iperf3"}
                            )

访问实例的属性:

>>> inst = [i for i in client.Instances.list()][0]

>>> inst.security_groups[0]
SecurityGroup({'id': '2472c0bb-1fa9-4dcc-a658-4268e78ad907', 'name': 'default'})

>>> inst.security_groups
[SecurityGroup({'id': '2472c0bb-1fa9-4dcc-a658-4268e78ad907', 'name': 'default'}),
 SecurityGroup({'id': 'd3040f01-3b12-4712-9e8e-8ecb1ae7ba04', 'name': 'standard'}),
 SecurityGroup({'id': '56370632-ceeb-4357-a5d3-f2c3acf9d69e', 'name': 'Folding@home'})]

>>> inst.ssh_keys
[SSHKey({'id': '848a6631-486a-4992-8a40-5a9027415d02', 'name': 'oz123')]

>>> inst.image
Image({'id': '3c5f9b6f-2f4b-4067-ba50-925be9e6afb1', 'name': 'Ubuntu 18.04'})

对本项目的贡献

首先,确保安装了pipenv。在

运行pipenv shell,然后运行pipenv install。在

编写测试,添加特性,使用make test测试功能。 git commit和{}:-)

做个公关!在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带有外部属性文件的java prunsrv服务   java NoClassDefFoundError:org/hibernate/annotations/common/reflection/MetadataProvider   使用Android Studio进行java单元测试云数据存储   java如何使用Junit在SeleniumWebDriver中生成测试用例报告   java根据用户输入显示多个动画形状(JavaFX)   java枚举文件和Jar资源的统一机制   使用Spring OXM的java多封送器/解封器   java无法解析:com。谷歌。安卓exoplayer:exoplayer smoothstreaming:2.9.1   java如何创建迷你对话框(带图片)   java在eclipse中单击自定义菜单项时显示一个对话框   java使用Hibernate在插入前检查重复值   Jsoup只过滤掉从html到文本的一些标记   域在字符串Java Mail中包含非法字符   自定义Jackson反序列化程序中的java委托   java Graphql联合在扩展关系上返回null   java如果我有entitymanager,如何获取会话对象?