Skip to content

Commit fb60651

Browse files
yufei.liyufeiminds
authored andcommitted
initial services
1 parent d6e74eb commit fb60651

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+6664
-5086
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.travis.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,40 @@ python:
55
- 3.7
66
- 3.6
77
- 3.5
8+
dist: xenial
9+
sudo: true
810

911
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
1012
install: pip install -U tox-travis
1113

1214
# command to run tests, e.g. python setup.py test
1315
script: tox
1416

15-
# deploy new versions to PyPI
16-
deploy:
17-
provider: pypi
18-
distributions: sdist bdist_wheel
19-
skip_existing: true
20-
user: ucloud
21-
password:
22-
secure: PLEASE_REPLACE_ME
23-
on:
24-
tags: true
25-
repo: ucloud/ucloud-sdk-python3
26-
python: 3.7
17+
before_deploy:
18+
- pip install -e .[doc]
19+
- make docs
20+
- touch docs/build/html/.nojekyll
2721

22+
# deploy new versions to PyPI / GithubIO
23+
deploy:
24+
- provider: pages
25+
skip_cleanup: true
26+
github_token:
27+
secure: "6QeIhg8F4Ztr+u4C7KuwmsiinglEBwjSafN/QYVf4pmJ6Jn5HzJSbZYPsHhqkDS0HbrJr4IOYkTL9ezeKif1Jd8lQ2ZrtTrKxvWiuO2EysF2hk0j0nDbYsaGct+Aam5M1mr2EVU6mwrr34sivs6pn6ZcpMNcpPHWMDIg5+2WyOspP9mWDFGTcOapvtky8SKpmpffmRnOcrsziYKEgDv/s9zJrP4IJ9CoICvMdgQMNb7OfIhNNBow6UOV7gkczOajFLCSmO/cFOyO5D/V/B+6DCUaYLlFr/az224+KSflkB7WWtEouJ+hlLV0T9XyabmZG+pp8jutgBnygXBwVMFj29AfCC0fCuZzXoQofYZNnLPpGUxdDQpZrDhMe85D3dXS+2FT8zc8bJ5Sdr7K8b70xLrZunzSxGT9LBa5riN+rqsB3laSEk4j5+WGye4U2RIsak3jTe4Hr3MnPIS/Xaof/2bn7ikInLa5W98KVUHbIute0B2FpZkOl0u4NatPrZJHUVhYII7m4jnZzoOCDWRpV09okwkHtLaGE7ekNTIa2Qgdbj6gdJ5kYl6kngT+3hYOVmz6txCHB7sfZhizl/wq1zf2YU6gL2JiSg8noYuLd/Fasulu9cpogjrvj/TPAw1W4vSk9CMwEU8REiCyU5lrCK2FJPKQeH/h0wXZ3kPhGGo="
28+
local_dir: docs/build/html
29+
on:
30+
branch: master
31+
tags: true
32+
repo: ucloud/ucloud-sdk-python3
33+
python: 3.7
34+
- provider: pypi
35+
distributions: sdist bdist_wheel
36+
skip_existing: true
37+
user: ucloud
38+
password:
39+
secure: "IVZJgV6z5wYb53RP1XNIO4aOedbdlSCGNSKfnMVugmeVFCLoBZsT99FeRzmQ8xFUU6PBSL4avX1QBgzYBIKqksTMVR4bFDha+Nw4NChy/XK7AEsGXnzyb8usnzqx4GzopDGZWqY8mNAd4UVsrmhcdYozKU8ZdSAg/H5zm/yx2Jnv8mcjFrdC11Mv+qtHbNLADvNwV6mACNvPr9jAVtkoYSLZ+mOEc6ZoORgxhcpnZXSb2ABnC/7BvCqqnlrDYNftMFF21lX7xHsA+il0xkWMrrsapWSueW4y1wWt5WksfOjFL2F0fbkS18CMYoIqCyk0A6BVkvqR0n9JUFwA9Zz1bikf4ZdMsQyLcjb9l5Xfc4+ij22oevrnQ0A90lgZi8foiCRiMGAiKyxY91pEAfrSEj+TWqqWlHAv6HPKU+975dSkQIZHhlL0cyqxx0Zl/SvcQ1deGyuXnME4VJm6fyoq+aI47Yg8ZFGuwGbJyCVZrsA+8thDUHTf5BNlMMIqQn8RYoHOsAIpgkVzcHa2Ko/kQRcTrhYoUIN9EoR4wuxjFhW1UGRe8khazT4qu9jIpT7TnuWX5xxHL+ZRTaiwMr5ZU79WVvnYNZymKLMWQ0ExVsIix+Z8BwO+pK9FyQ8mMgVWdCJDepVDZgcSdikd4+i81UfJkF71bu50Y7el/rqrOrA="
40+
on:
41+
branch: master
42+
tags: true
43+
repo: ucloud/ucloud-sdk-python3
44+
python: 3.7

README.rst

Lines changed: 8 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,23 @@
1-
UCloud SDK Python3
2-
==================
1+
UCloud SDK Python 3
2+
===================
33

44
UCloud SDK is a Python client library for accessing the UCloud API.
55

66
This client can run on Linux, macOS and Windows. It requires Python 3.5 and above.
77

88
- Website: https://www.ucloud.cn/
99
- Free software: Apache 2.0 license
10-
- `Documentation <https://ucloud-sdk-python3.readthedocs.org>`_
10+
- `Documentation <https://ucloud.github.io/ucloud-sdk-python3/>`_
1111

12-
.. image:: https://img.shields.io/pypi/v/agen.svg
12+
.. image:: https://img.shields.io/pypi/v/ucloud-sdk-python3.svg
1313
:target: https://pypi.python.org/pypi/ucloud-sdk-python3/
1414
:alt: Latest Version
15-
.. image:: https://travis-ci.org/yufeiminds/agen.svg?branch=master
15+
.. image:: https://travis-ci.org/ucloud/ucloud-sdk-python3.svg?branch=master
1616
:target: https://travis-ci.org/ucloud/ucloud-sdk-python3
1717
:alt: Travis CI Status
18-
.. image:: https://codecov.io/github/yufeiminds/agen/coverage.svg?branch=master
18+
.. image:: https://codecov.io/github/ucloud/ucloud-sdk-python3/coverage.svg?branch=master
1919
:target: https://codecov.io/github/ucloud/ucloud-sdk-python3?branch=master
2020
:alt: Codecov Status
21-
.. image:: https://readthedocs.org/projects/agen/badge/?version=latest
22-
:target: https://ucloud-sdk-python3.readthedocs.org/en/latest/?badge=latest
21+
.. image:: https://img.shields.io/badge/docs-passing-brightgreen.svg
22+
:target: https://ucloud.github.io/ucloud-sdk-python3/
2323
:alt: Doc Status
24-
25-
Installation
26-
------------
27-
28-
Install with pip:
29-
30-
.. code:: shell
31-
32-
pip install ucloud-sdk-python3
33-
34-
Install with source code:
35-
36-
.. code:: shell
37-
38-
clone https://github.com/ucloud/ucloud-sdk-python3.git
39-
cd ucloud-sdk-python3
40-
python setup.py install
41-
42-
QuickStart
43-
----------
44-
45-
Currently, user public key & private key is the only method of authenticating with the API. You could get your keys here:
46-
47-
- [Key Generation](https://console.ucloud.cn/uapi/apikey)
48-
49-
You can then use your keys to create a new client of uhost service:
50-
51-
.. code-block:: python
52-
53-
# demo
54-
55-
56-
.. note:: UHost created above cannot be accessed via Internet unless an EIP is created and bind to the UHost.
57-
58-
User can also use complex structure in query, eg. set array as query:
59-
60-
.. code-block:: python
61-
62-
# demo
63-
64-
will encoded as `UHostIds.0=uhost-xxx&UHostIds.1=uhost-yyy` describe in ``
65-
66-
Advantage Usage
67-
---------------
68-
69-
Type System
70-
~~~~~~~~~~~
71-
72-
UCloud Python SDK has completed type system for static and runtime type checking.
73-
74-
Wait State Changed
75-
~~~~~~~~~~~~~~~~~~
76-
77-
Feedback & Contribution
78-
-----------------------
79-
80-
- [Issue](https://github.com/ucloud/ucloud-sdk-go/issues)
81-
- [Pull Request](https://github.com/ucloud/ucloud-sdk-go/pulls)
File renamed without changes.

docs/core.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Core
2+
====
3+
4+
Config
5+
------
6+
7+
.. autoclass:: ucloud.core.auth.Credential
8+
:members:
9+
10+
.. autoclass:: ucloud.core.client.Config
11+
:members:
12+
13+
Client
14+
------
15+
16+
.. autoclass:: ucloud.core.client.Client
17+
:members:
18+
19+
Transport
20+
---------
21+
22+
.. autoclass:: ucloud.core.transport.RequestsTransport
23+
:members:
24+
25+
Middleware
26+
----------
27+
28+
.. autoclass:: ucloud.core.utils.middleware.Middleware
29+
:members:
30+
31+
Testing
32+
-------
33+
34+
.. automodule:: ucloud.core.testing.env
35+
:members:

docs/helpers.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Helpers
2+
=======
3+
4+
Wait Resource State
5+
-------------------
6+
7+
.. autofunction:: ucloud.helpers.wait.wait_for_state
8+
9+
Utilities
10+
---------
11+
12+
.. automodule:: ucloud.helpers.utils
13+
:members:

docs/index.rst

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,56 @@
1-
.. include:: ../README.rst
1+
UCloud SDK Python 3
2+
===================
3+
4+
UCloud SDK is a Python client library for accessing the UCloud API.
5+
6+
This client can run on Linux, macOS and Windows. It requires Python 3.5 and above.
7+
8+
- Website: https://www.ucloud.cn/
9+
- Free software: Apache 2.0 license
10+
- `Documentation <https://ucloud.github.io/ucloud-sdk-python3/>`_
11+
12+
.. image:: https://img.shields.io/pypi/v/ucloud-sdk-python3.svg
13+
:target: https://pypi.python.org/pypi/ucloud-sdk-python3/
14+
:alt: Latest Version
15+
.. image:: https://travis-ci.org/ucloud/ucloud-sdk-python3.svg?branch=master
16+
:target: https://travis-ci.org/ucloud/ucloud-sdk-python3
17+
:alt: Travis CI Status
18+
.. image:: https://codecov.io/github/ucloud/ucloud-sdk-python3/coverage.svg?branch=master
19+
:target: https://codecov.io/github/ucloud/ucloud-sdk-python3?branch=master
20+
:alt: Codecov Status
21+
.. image:: https://img.shields.io/badge/docs-passing-brightgreen.svg
22+
:target: https://ucloud.github.io/ucloud-sdk-python3/
23+
:alt: Doc Status
24+
25+
Guide
26+
-----
27+
28+
.. toctree::
29+
:maxdepth: 2
30+
31+
quick_start
32+
usage
33+
34+
.. include:: quick_start.rst
35+
36+
API Reference
37+
-------------
38+
39+
.. toctree::
40+
:maxdepth: 2
41+
42+
services
43+
helpers
44+
core
245

346
Indices and tables
447
------------------
548

649
* :ref:`genindex`
7-
* :ref:`modindex`
850
* :ref:`search`
951

10-
API Guide
11-
---------
12-
13-
Here is the API reference for agen.
52+
Feedback & Contribution
53+
-----------------------
1454

15-
.. module:: ucloud
55+
- `Issue <https://github.com/ucloud/ucloud-sdk-python3/issues>`_
56+
- `Pull Request <https://github.com/ucloud/ucloud-sdk-python3/pulls>`_

docs/quick_start.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
QuickStart
2+
==========
3+
4+
Installation
5+
------------
6+
7+
Install with pip:
8+
9+
.. code:: shell
10+
11+
pip install ucloud-sdk-python3
12+
13+
Install with source code:
14+
15+
.. code:: shell
16+
17+
clone https://github.com/ucloud/ucloud-sdk-python3.git
18+
cd ucloud-sdk-python3
19+
python setup.py install
20+
21+
QuickStart
22+
----------
23+
24+
Currently, user public key & private key is the only method of authenticating with the API. You could get your keys here:
25+
26+
- `Key Generation <https://console.ucloud.cn/uapi/apikey>`_
27+
28+
You can then use your keys to create a new client of uhost service:
29+
30+
.. code-block:: python
31+
32+
from ucloud.core import exc
33+
from ucloud.client import Client
34+
35+
client = Client({
36+
"region": "cn-bj2",
37+
"project_id": "...",
38+
"public_key": "...",
39+
"private_key": "...",
40+
})
41+
42+
try:
43+
resp = client.uhost().create_uhost_instance({
44+
'Name': 'sdk-python-quickstart',
45+
'Zone': image["zone"],
46+
'ImageId': image["image_id"],
47+
'LoginMode': "Password",
48+
'Password': utils.b64encode(utils.gen_password(20)),
49+
'CPU': 1,
50+
'Memory': 1,
51+
'Disks': [{
52+
'Size': 10,
53+
'Type': 'CLOUD_SSD'
54+
}],
55+
})
56+
except exc.UCloudException as e
57+
print(e)
58+
else:
59+
print(resp)
60+
61+
.. note:: UHost created above cannot be accessed via Internet unless an EIP is created and bind to the UHost.

0 commit comments

Comments
 (0)