WIP
Rancher API
Python wrapper for Rancher API
Usage
Connecting to Environment
import pyranch
rancher = pyranch.Environment(<RANCHER_URL>, <RANCHER_ACCESS_KEY>, <RANCHER_SECRET_KEY>, project_id=<ENVIRONMENT_ID>)
Additional parameters:
- port - Rancher API port, default
80 - api_version - Rancher API version, default
v2-beta
Working on Environment
- activate
- deactivate
- upgrade
- set_members #TODO More information can be found here
Working on Stack
Stack fields
| Field | Type | Required | Can update | Default |
|---|---|---|---|---|
| binding | dict | No | Yes | {} |
| description | str | No | Yes | None |
| dockerCompose | str | No | No | |
| environment | dict | No | No | {} |
| externalId | str | No | Yes | None |
| group | str | No | Yes | None |
| name | str | Yes | Yes | |
| outputs | dict | No | Yes | {} |
| previousEnvironment | dict | No | Yes | {} |
| previousExternalId | str | No | Yes | None |
| rancherCompose | str | No | No | |
| startOnCreate | bool | No | No | False |
| Read only values | ||||
| Field | Type | |||
| id | str | |||
| healthState | str | |||
| serviceIds | list | |||
| system | bool |
Initialize stack object
cows = rancher.stack(stack_name='cows')
Note: Existing stacks can be initialized using stack_id
Create Stack in rancher
cows.description = 'Stack of cows'
cows.create()
Print Stack data
cows()
Update Stack
cows.name = "bulls"
cows.description = "Stack of bulls"
cows.save()
Stack actions
More actions can be found here
Working on Service
Service fields
| Field | Type | Required | Can update | Default |
|---|---|---|---|---|
| assignServiceIpAddress | bool | No | No | False |
| description | str | No | Yes | None |
| externalId | str | No | No | None |
| launchConfig | dict | No | No | {} |
| lbConfig | dict | No | Yes | {} |
| metadata | dict | No | Yes | {} |
| name | str | Yes | Yes | |
| retainIp | bool | No | Yes | False |
| scale | int | No | Yes | 1 |
| scalePolicy | dict | No | Yes | {} |
| secondaryLaunchConfigs | list | No | No | [] |
| selectorContainer | str | No | Yes | None |
| selectorLink | str | No | Yes | None |
| stackId | dict | No | No | {} |
| startOnCreate | bool | No | No | False |
| vip | str | No | No | None |
| Read only values | ||||
| Field | Type | |||
| id | str | |||
| healthState | str | |||
| system | bool | |||
| instanceIds | list | |||
| createIndex | int | |||
| currentScale | int | |||
| fqdn | str | |||
| linkedServices | dict | |||
| publicEndpoints | list | |||
| upgrade | dict |
Initialize Service object
cow = rancher.service(stack_name='cows')
Note: Existing service can be initialized using service_id
Create Service in rancher
cow.description = 'Our Cow'
cow.create()
Print service data
cow()
Update service
cow.name = 'bull'
cow.description = "Our bull"
cow.save()
Scale service
cow.scale_out(1)
cow.scale_in(1)
Service Log
cow.logs()['data']
Service actions
More actions can be found here
Metadata
Release files for pyranch 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyranch-0.0.6.tar.gz | 8.8 kB | Without provenance | Details for pyranch-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyranch-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for pyranch-0.0.6-py3-none-any.whl |
Total release size: 20.3 kB
Release files / pyranch-0.0.6.tar.gz
| Download URL | pyranch-0.0.6.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ea671b9c65464b6ffaa19c36e9db7a418c9b36e75b1ee24da6961cf87ac9bd0
|
|
BLAKE2b-256 checksum How to use checksums |
aff08fc3b31c037f4f2463dfe98e8e87c0427db62b5b9f5bdd87b3e9ae7aee88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.12
|
Release files / pyranch-0.0.6-py3-none-any.whl
| Download URL | pyranch-0.0.6-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88748afc6222fb784801751ef2900369af6613f90e550d212cb99ae34dcb8274
|
|
BLAKE2b-256 checksum How to use checksums |
f9ffc4eab7054c307975bcdd50db4169abfdc8f6a6d5bf2bd9782408d886dc13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.12
|
Security for pyranch 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.