Package: confectionary-confetti
ConfettiConfectionary confetti to confine those confounded configurations confidentlyInstall in your application$pipinstallgit+ssh://git@github.com/AmberEngine/confectionary-confetti.git#egg=confectionary-confettiCreate 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.fromconfettiimportConfettisession=boto3.session.Session()confetti=Confetti(session=session)print(confetti.path)Output/Development/ConfettiChoose 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.$exportCONFETTI_KEY=YourKeyfromconfettiimportConfetticonfetti=Confetti()print(confetti.path)Output/YourKey/ConfettiThe confetti_key keyword argument overrides the CONFETTI_KEY environment variable.fromconfettiimportConfetticonfetti=Confetti(confetti_key='YourKey')print(confetti.path)Output/YourKey/ConfettiChoose 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.fromconfettiimportConfetticlassMyApp(Confetti):passconfetti=MyApp()print(confetti.path)Output/Development/MyAppSet CONFETTI_PATH environment variable. The CONFETTI_PATH environment overrides the default.$exportCONFETTI_PATH=Your/PathfromconfettiimportConfetticonfetti=Confetti()print(confetti.path)Output/Development/Your/PathThe confetti_path keyword argument overrides the CONFETTI_PATH environment variable.fromconfettiimportConfetticonfetti=Confetti(confetti_path='Your/Path')print(confetti.path)Output/Development/Your/PathRetrieve 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'.fromconfettiimportConfetticonfetti=Confetti(confetti_key="Production",confetti_path="MyApp")parameters=confetti.get_parameters()# Print the value of a specific parameterprint(parameters.APP_URL)# Print your parametersprint(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'.fromconfettiimportConfetti# Create your app's configconfetti=Confetti(confetti_key="Production",confetti_path="MyApp")# Export to JSON from AWS SSM parameter storeconfetti.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.fromconfettiimportConfetti# Create your app's configconfetti=Confetti(confetti_key="Production",confetti_path="MyApp")# Import parameters from JSON to AWS SSM parameter storeconfetti.import_parameters("parameters.json")see also:AWS Systems Manager Parameter StoreandSSM.Client.put_parameter