Skip to main content

Confetti

Confectionary confetti to confine those confounded configurations confidently

Install in your application

$ pip install git+ssh://git@github.com/AmberEngine/confectionary-confetti.git#egg=confectionary-confetti

Create a boto3 session. If you don't create a session, one will be created for you using your AWS user configuration or role.

The session keyword argument overrides the default session.

    from confetti import Confetti
    
    session = boto3.session.Session()
    confetti = Confetti(session=session)
    
    print(confetti.path)

Output

/Development/Confetti

Choose a key. Your key will the root of the namespacing path of your application's parameters and will be used as an alias for a KMS key to encrypt and decrypt your parameters. If you don't choose a key, the default value is 'Development'.

Set CONFETTI_KEY environment variable. The CONFETTI_KEY environment overrides the default.

$ export CONFETTI_KEY=YourKey
    from confetti import Confetti
    
    confetti = Confetti()
    
    print(confetti.path)

Output

/YourKey/Confetti

The confetti_key keyword argument overrides the CONFETTI_KEY environment variable.

    from confetti import Confetti
    
    confetti = Confetti(confetti_key='YourKey')
    
    print(confetti.path)

Output

/YourKey/Confetti

Choose a path. Your path will be appended to the namespacing path of your application's parameters, i.e. /<confetti_key>/<confetti_path>. e.g. /YourKey/Your/Path. If you don't choose a path, the default value is the name of the Confetti class.

Override the Confetti class and use MyApp as the default.

    from confetti import Confetti
    
    class MyApp(Confetti):
        pass
    
    confetti = MyApp()
    
    print(confetti.path)

Output

/Development/MyApp

Set CONFETTI_PATH environment variable. The CONFETTI_PATH environment overrides the default.

$ export CONFETTI_PATH=Your/Path
    from confetti import Confetti
    
    confetti = Confetti()
    
    print(confetti.path)

Output

/Development/Your/Path

The confetti_path keyword argument overrides the CONFETTI_PATH environment variable.

    from confetti import Confetti
    
    confetti = Confetti(confetti_path='Your/Path')
    
    print(confetti.path)

Output

/Development/Your/Path

Retrieve and use your parameters in your application. Note that it is assumed that your SecureString parameters are to be retrieved with decryption. You can override the parameters to SSM.Client.get_parameters_by_path via keyword arguments with the exception of 'Path'.

    from confetti import Confetti

    confetti = Confetti(confetti_key="Production", confetti_path="MyApp")
    parameters = confetti.get_parameters()

    # Print the value of a specific parameter
    print(parameters.APP_URL)

    # Print your parameters
    print(parameters)

Store parameters from a JSON file.

Create a JSON file with your new parameters

[{
    "Name": "APP_URL",
    "Value": "http://www.mrcoolice.com/app",
    "Type": "String"
}, {
    "Name": "APP_KEY",
    "Value": "abcde12345",
    "Type": "SecureString"
}, {
    "Name": "THINGS",
    "Value": "thing1, thing2",
    "Type": "StringList"
}]

Export your current parameters to a JSON file so you can modify them. Note that it is assumed that your SecureString parameters are to be retrieved with decryption. You can override the parameters to SSM.Client.get_parameters_by_path via keyword arguments with the exception of 'Path'.

    from confetti import Confetti

    # Create your app's config
    confetti = Confetti(confetti_key="Production", confetti_path="MyApp")

    # Export to JSON from AWS SSM parameter store
    confetti.export_parameters("parameters.json")

Review and modify your parameters.

[{
    "Name": "APP_URL",
    "Value": "http://www.mrcoolice.com/app",
    "Type": "String",
    "Overwrite": true
}, {
    "Name": "APP_KEY",
    "Value": "abcde12345",
    "Type": "SecureString",
    "Overwrite": true
}, {
    "Name": "THINGS",
    "Value": "thing1, thing2",
    "Type": "StringList",
    "Overwrite": true
}]

Set your parameters for your application. Do this only once and your parameters will be stored in your AWS SSM Parameter Store.

    from confetti import Confetti

    # Create your app's config
    confetti = Confetti(confetti_key="Production", confetti_path="MyApp")

    # Import parameters from JSON to AWS SSM parameter store
    confetti.import_parameters("parameters.json")

see also: AWS Systems Manager Parameter Store and SSM.Client.put_parameter

Metadata

Release files for confectionary-confetti 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for confectionary-confetti 0.0.1
File Size Uploaded
confectionary-confetti-0.0.1.tar.gz 4.5 kB Details

Release files / confectionary-confetti-0.0.1.tar.gz

Download URL confectionary-confetti-0.0.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5796a53e3651ab2ece29b5520ab687455745ce28dde982347160750f0b21b336
BLAKE2b-256 checksum
How to use checksums
739d6976257b5299af27a28eec47cbe4ae4689747630c247b46b453e5f4304b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page