Package: idem-core-functions
Idem plugin with built-in functionsAboutAn Idem plugin containing common functions that you can run with theexec.runstate. You can use argument binding to pass the output of these common functions to other Idem plugin resource states, such as inidem-aws,idem-k8s, or other Idem plugins.What is POP?This project is built withpop, a Python-based implementation ofPlugin 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:Intro to Plugin Oriented Programming (POP)pop-awesomepop-createGetting StartedPrerequisitesPython 3.8+git(if installing from source or contributing to the project)To contribute to the project and set up your local development environment, seeCONTRIBUTING.rstin the source repository for this project.InstallationYou can installidem-core-functionswith the Python package installer (PyPI) or from source.Install from PyPIpipinstallidem-core-functionsInstall from Source# clone repogitclonegit@<your-project-path>/idem-core-functions.gitcdidem-core-functions# Setup venvpython3-mvenv.venvsource.venv/bin/activatepipinstall-e.UsageSetupAfter installation,idem-core-functionsexecution modules are accessible to the pophub.For more information:Intro to Plugin Oriented Programming (POP)pop hubYou are now ready to use idem-core-functions.Exec ModuleAn SLS file specifies the desired state of a resource. You can run an exec module within an SLS file using theexec.runstate, where the exec module returns a new state that can be referenced with argument binding.core.encoding.base64encodeApply Base64 encoding to a string.core.encoding.base64decodeRestore a Base64 encoded character string to the original string.core.conversion.to_jsonSerialize an object to a string of JSON.core.collection.distinctFor a given list, return a new list with any duplicate elements removed.core.collection.flattenFor a given list, replace any elements that are lists with a flattened sequence of that list.core.collection.elementRetrieve a single element from a list.core.collection.lengthDetermine the length of a given list, map, or string.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-encryptionExamples: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-encryptionIdem command line examples:idemexecexec.core.encoding.base64encodedata=sample-dataidemexecexec.core.encoding.base64decodeencoded_data=dGVzdC11c2VyLW5hbWU6dGVzdC1wYXNzd29yZA==Current Supported Exec Functionscoreconversioncollectionencoderencryption