3scale CRD Python Client
Project description
3scale-api-python-crd
3scale client uses CRs for object definition. CRs are processed by 3scale Operator.
Installing
Install and update using pip:
pip install 3scale-api-crd
Or as a dependency using the pipenv
pipenv install 3scale-api-crd
Usage
Client supports basic CRUD operations and it generates CRs in Openshift namespace defined by oc
session.
Basic usage of the client:
oc login
oc project example
import threescale_api_crd
client = threescale_api_crd.ThreeScaleClientCRD(url="myaccount.3scale.net", token="secret_token", ssl_verify=True, ocp_provider_ref="secret_with_credentials")
Using of objects are described in 3scale API client README.
Run the Smoke Tests
To run the tests you need to have installed development dependencies:
pipenv install --dev
and then run the pytest
:
pipenv run pytest -m smoke
Integration tests configuration
To run the integration tests you need to set these extra env variables:
THREESCALE_PROVIDER_URL='https://example-admin.3scale.net'
THREESCALE_PROVIDER_TOKEN='<test-token>'
THREESCALE_MASTER_URL='https://master.3scale.net'
THREESCALE_MASTER_TOKEN='<test-master-token>'
and to have valid oc
tool session to Openshift where 3scale Operator is deployed and watches for CRs.
By default:
- oc
namespace should be the namespace where 3scale instance is deployed
- the system-seed
secret is used by 3scale Operator client
- THREESCALE_
variables are used for not implemented Threescale client features
If CRs are created in different namespace to 3scale deployment, env variable
OCP_PROVIDER_ACCOUNT_REF
can be specified with secret name used by 3scale Operator client,
see https://github.com/3scale/3scale-operator/blob/master/doc/backend-reference.md#provider-account-reference
Finished integration unit tests
- AccountUsers
- Accounts
- ActiveDocs
- ApplicationPlans
- BackendMappingRules
- BackendMetrics
- BackendUsages
- Backends
- Limits
- MappingRules
- Metrics
- OpenApis
- Policies
- PolicyRegistries
- PricingRules
- Proxies
- Services
- Tenants
- ProxyConfigPromote
- Applications
- Methods
Command to run integration unit tests: pipenv run pytest --log-cli-level=10 -vvvv -s ./tests/integration/ |& tee x
TODO
- do https://github.com/3scale/3scale-operator/pull/813
- do not simulate app plan id
- create unit integration tests for:
- ProductDeploymentSpec
- AuthenticationSpec
- implement delete of policies + add unit tests
- add proper error messages in case of for example missing required arguments, see test_should_fields_be_required
- implement optimitazation on the oc level:
- for every test run, label objects - oc label product.capabilities.3scale.net/testyrclkfzyhue test_run=new --overwrite
- use only objects labeled by test run id - oc get product.capabilities.3scale.net --show-labels=true -l test_run=new
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
Built Distribution
File details
Details for the file 3scale-api-crd-0.1.0.tar.gz
.
File metadata
- Download URL: 3scale-api-crd-0.1.0.tar.gz
- Upload date:
- Size: 40.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f795d74f321cbc46d445f7689c4897bcc26792360baa0b5e15e291d8c2178b0 |
|
MD5 | d342ade66b7340f244d43a9235412369 |
|
BLAKE2b-256 | b8037aad4ea0fbe875f68cd4237a45a8245b2f8f321ee10a79069b9468f69aca |
File details
Details for the file 3scale_api_crd-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: 3scale_api_crd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 50.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f676e5deebd30a32abd0ad0df55e39543d40f6151284e49326d956e34c63883 |
|
MD5 | a1c872fd09fff9868a211525d78db172 |
|
BLAKE2b-256 | 02e95b3ebb0a128c4caa7d96d6cf4f85111f096476161fff7098b65b893a85f8 |