Skip to main content

No project description provided

Project description

Made with pop, a Python implementation of Plugin Oriented Programming Made with Python

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

idem-core-functions-0.2.2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idem_core_functions-0.2.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file idem-core-functions-0.2.2.tar.gz.

File metadata

  • Download URL: idem-core-functions-0.2.2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/5.1.0 keyring/23.11.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16

File hashes

Hashes for idem-core-functions-0.2.2.tar.gz
Algorithm Hash digest
SHA256 928418c8c67b003f955bfc0f9cae7e9afb6aeff553079a70b42b677d7147884d
MD5 5299ebb13bf294ea9409c53a55b04a81
BLAKE2b-256 02776a45b679e28baeedb65e865ea3632c4e4383353d85ea39ef285a9da725b4

See more details on using hashes here.

File details

Details for the file idem_core_functions-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: idem_core_functions-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/5.1.0 keyring/23.11.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16

File hashes

Hashes for idem_core_functions-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 921a9bf01b7e77a3f547b7150188d715a03f2f68ad7ba5c89a39d351ec882906
MD5 dc720d0c3e86ee6cead4720853ee3fe3
BLAKE2b-256 346423453738e5a7b059aa62c1ab1ea7e49187fd04f061b7a0e82399e6c3e0fc

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