Best Python code snippet using localstack_python
vault.py
Source:vault.py
...99 """100 return pulumi.get(self, "arn")101 @property102 @pulumi.getter(name="kmsKeyArn")103 def kms_key_arn(self) -> pulumi.Output[str]:104 """105 The server-side encryption key that is used to protect your backups.106 """107 return pulumi.get(self, "kms_key_arn")108 @property109 @pulumi.getter110 def name(self) -> pulumi.Output[str]:111 """112 Name of the backup vault to create.113 """114 return pulumi.get(self, "name")115 @property116 @pulumi.getter(name="recoveryPoints")117 def recovery_points(self) -> pulumi.Output[int]:...
get_vault.py
Source:get_vault.py
...50 """51 return pulumi.get(self, "id")52 @property53 @pulumi.getter(name="kmsKeyArn")54 def kms_key_arn(self) -> str:55 """56 The server-side encryption key that is used to protect your backups.57 """58 return pulumi.get(self, "kms_key_arn")59 @property60 @pulumi.getter61 def name(self) -> str:62 return pulumi.get(self, "name")63 @property64 @pulumi.getter(name="recoveryPoints")65 def recovery_points(self) -> int:66 """67 The number of recovery points that are stored in a backup vault.68 """...
manage.py
Source:manage.py
1#!/usr/bin/python2import boto33import click4from pybase64 import b64encode5from asym_crypto_yaml import (6 load, Encrypted, decrypt_value,7 load_private_key_from_file,8 load_private_key_from_string9)10def perform_deploy_lambda_envs(config_file_path, private_key_content, private_key_path, kms_key_arn, lambda_name):11 """12 Loads private key to deploy the application's secret values to corresponding lambda13 :config_file_path = path to config file14 :private_key_content = content of private key15 :private_key_path = path to the private key16 :kms_key_arn = arn for an aws kms_key17 :lambda_name = name of an aws lambda function18 """19 private_key = None20 if private_key_path is not None:21 private_key = load_private_key_from_file(private_key_path)22 elif private_key_content is not None:23 # GoCD will mangle the encrypted key when it is passed in this way24 # The following lines unmangle the key.25 private_key_content = private_key_content.replace(' ', '\n')26 private_key_content = private_key_content.replace('-----BEGIN\nRSA\nPRIVATE\nKEY-----',27 '-----BEGIN RSA PRIVATE KEY-----')28 private_key_content = private_key_content.replace('-----END\nRSA\nPRIVATE\nKEY-----',29 '-----END RSA PRIVATE KEY-----')30 private_key = load_private_key_from_string(private_key_content.encode('utf-8'))31 if private_key is None:32 raise ValueError('You must specify the private key either by PRIVATE_KEY ENV, or with private-key-path')33 push_config_and_secrets_to_lambda_env(config_file_path, private_key, kms_key_arn, lambda_name)34def push_config_and_secrets_to_lambda_env(config_file_path, private_key, kms_key_arn, lambda_name):35 """36 Pushes the application's configurations and secret (encrypted) values to37 the corresponding lambda function. The application will have to decrypt value38 :config_file_path = path to config file39 :private_key = private key of application40 :kms_key_arn = arn for an aws kms_key41 :lambda_name = name of an aws lambda function42 """43 with open(config_file_path) as f:44 config = load(f)45 if config is None:46 config = {}47 for key, value in config.items():48 if type(value) == Encrypted:49 config[key] = kms_encrypt(kms_key_arn, decrypt_value(value, private_key))50 client = boto3.client('lambda')51 response = client.update_function_configuration(52 FunctionName=lambda_name,53 Environment={54 'Variables': config55 }56 )57def kms_encrypt(kms_key_arn, value):58 """59 Uses AWS KMS to encrypt the value of an environment variable60 :kms_key_arn = arn for an aws kms_key61 :value = the value of an environment variable62 """63 client = boto3.client('kms')64 response = client.encrypt(65 KeyId=kms_key_arn,66 Plaintext=value,67 )68 # returns the encrypted 64 bit string...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!