No project description provided
Project description
About
Idem plugin with built-in functions
What is POP?
This project is built with pop, a Python-based implementation of Plugin Oriented Programming (POP). POP seeks to bring together concepts and wisdom from the history of computing in new ways to solve modern computing problems.
For more information:
Getting Started
Prerequisites
Python 3.7+
git (if installing from source, or contributing to the project)
Installation
If wanting to use idem-core-functions, you can do so from source.
Install from source
# clone repo
git clone git@<your-project-path>/idem-core-functions.git
cd idem-core-functions
# Setup venv
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Usage
This Idem plugin functions can be executed with exec.run state that can then be used with other idem plugin like idem-aws, idem-k8s etc as arg-binding.
Setup
After installation, the idem-core-functions execution modules will be accessible to the pop hub.
For more information:
You are ready to use idem-core-functions!!!
Exec Module
Exec modules can be run from SLS using the “exec.run” state. The return from the exec module is put in the state’s “new_state”, so it can be used in arg_binding. The desired state of a resource can be specified in sls file. The “core.encoding.base64encode” to apply Base64 encoding to a string. The “core.encoding.base64decode” takes a string containing a Base64 character sequence and returns the original string. The “core.conversion.to_json” to serialize an object to a string of JSON The “core.collection.distinct” to return a new list with any duplicate elements removed for a given list. The “core.collection.flatten” to eplaces any elements that are lists with a flattened sequence of the list for a given list. The “core.collection.element” to retrieve a single element from a list. The “core.collection.length” to determine the length of a given list, map, or string.
Request Syntax:
[Idem-state-name]:
exec.run:
- path: core.encoder.base64.encode
- kwargs:
data: test-user-name:test-password
[Idem-state-name]:
exec.run:
- path: core.encoder.base64.decode
- kwargs:
encoded_data: dGVzdC11c2VyLW5hbWU6dGVzdC1wYXNzd29yZA==
[Idem-state-name]:
exec.run:
- path: core.conversion.to_json
- kwargs:
data: '{
"cluster_name": "idem-eks-test",
"region": "ap-south-1",
}'
[Idem-state-name]:
exec.run:
- path: core.encryption.gpg.encrypt
- kwargs:
data: test-data-for-encryption
Examples Usage:
vault_generic_secret.example-creds.search:
vault.secrets.kv_v1.secret.search:
- path: "example/projects.registry.example.com"
idem.core.encoder.base64.encode.test-2:
exec.run:
- path: core.encoder.base64.encode
- kwargs:
data: "${vault.secrets.kv_v1.secret:vault_generic_secret.example-creds.search:data:user}:${vault.secrets.kv_v1.secret:vault_generic_secret.example-creds.search:data:pass}"
kubernetes_secret.registry-secret-example:
k8s.core.v1.secret.present:
- resource_id: {{ params.get('kubernetes_secret.registry-secret-example') }}
- metadata:
name: "registrysecret-example"
- string_data:
".dockerconfigjson": |+
{
"auths": {
"projects.registry.example.com": {
"auth": "${exec:idem.core.b64Encode.test-2:data}"
}
}
}
- type: "kubernetes.io/dockerconfigjson"
idem.core.encryption.gpg.encrypt.test-1:
exec.run:
- path: core.encryption.gpg.encrypt
- kwargs:
data: test-data-for-encryption
It can be specified from command line when calling exec module as below
idem exec exec.core.encoding.base64encode data=sample-data
idem exec exec.core.encoding.base64decode encoded_data=dGVzdC11c2VyLW5hbWU6dGVzdC1wYXNzd29yZA==
Current Supported exec functions
core
conversion
collection
encoder
encryption
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 idem-core-functions-0.2.0.tar.gz
.
File metadata
- Download URL: idem-core-functions-0.2.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/5.0.0 keyring/23.9.3 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddd60c434301e71a8c91b25140dfbc245c99d27008c97519a90db8fa93a2c867 |
|
MD5 | 82ee83e560fa0b5c4f75c2b1ca75cc4c |
|
BLAKE2b-256 | 73696dd3091771ea5dfa03e63e7300efd84eef412000103e86f53d1e7eda5bf1 |
File details
Details for the file idem_core_functions-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: idem_core_functions-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/5.0.0 keyring/23.9.3 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5a023c43fb4b88caac01886d77bfe4a01cfd111df94d9ccba11cb0d2117d516 |
|
MD5 | 00c50e86504d2f859e17b84ab380eb96 |
|
BLAKE2b-256 | 588d1caf2aed89f95c55275f9d38bee66176253ec16496a62f3a6aa971f6b97a |