Skip to main content

Software Development Kit for GYUN.

Project description

This repository allows you to access GYUN and control your resources from your applications.

This SDK is licensed under Apache Licence, Version 2.0.

Installation

Install via pip

$ pip install gyun-sdk

Upgrade to the latest version

$ pip install --upgrade gyun-sdk

Install from source

git clone https://github.com/gyun-gome/gyun-sdk-python.git
cd gyun-sdk-python
python setup.py install

Getting Started

In order to operate GYUN IaaS or GomeStor (GYUN Object Storage), you need apply access key on gyun console first.

GYUN IaaS API

Pass access key id and secret key into method connect_to_zone to create connection

>>> import gyun.iaas
>>> conn = gyun.iaas.connect_to_zone(
        'zone id',
        'access key id',
        'secret access key'
    )

The variable conn is the instance of gyun.iaas.connection.APIConnection, we can use it to call resource related methods.

Example:

# launch instances
>>> ret = conn.run_instances(
        image_id='img-xxxxxxxx',
        cpu=1,
        memory=1024,
        vxnets=['vxnet-0'],
        login_mode='passwd',
        login_passwd='Passw0rd@()'
    )

# stop instances
>>> ret = conn.stop_instances(
        instances=['i-xxxxxxxx'],
        force=True
      )

# describe instances
>>> ret = conn.describe_instances(
        status=['running', 'stopped']
      )

GYUN GomeStor API

Pass access key id and secret key into method connect to create connection

>>> import gyun.gomestor
>>> conn = gyun.gomestor.connect(
        'pek3a.gomestor.com',
        'access key id',
        'secret access key'
    )

The variable conn is the instance of gyun.gomestor.connection.QSConnection, we can use it to create Bucket which is used for generating Key and MultiPartUpload.

Example:

# Create a bucket
>>> bucket = conn.create_bucket('mybucket')

# Create a key
>>> key = bucket.new_key('myobject')
>>> with open('/tmp/myfile') as f:
>>>     key.send_file(f)

# Delete the key
>>> bucket.delete_key('myobject')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gyun-sdk-1.1.2.1.tar.gz (47.4 kB view details)

Uploaded Source

File details

Details for the file gyun-sdk-1.1.2.1.tar.gz.

File metadata

  • Download URL: gyun-sdk-1.1.2.1.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gyun-sdk-1.1.2.1.tar.gz
Algorithm Hash digest
SHA256 81dd945bae4c199af49846705e92b425710cd89ed0fed34494fcaa1074ccbe45
MD5 475f12db8dfe6f668fd7c0ad9fd2dfab
BLAKE2b-256 40dff1bf9997ea247d04fef5189921db8516dcd6f3fca218d59bbc5cceb938b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page